We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6809d9c commit 1fbfa9aCopy full SHA for 1fbfa9a
src/Property/WalkProperty.php
@@ -152,7 +152,12 @@ public function isSimple()
152
*/
153
public function isHamiltonian()
154
{
155
- return $this->isArrayContentsEqual($this->walk->getVerticesSequence(), $this->walk->getGraph()->getVertices());
+ $vertices = $this->walk->getVerticesSequence();
156
+ // ignore starting vertex for cycles as it's always the same as ending vertex
157
+ if ($this->isCycle()) {
158
+ unset($vertices[0]);
159
+ }
160
+ return $this->isArrayContentsEqual($vertices, $this->walk->getGraph()->getVertices());
161
}
162
163
/**
0 commit comments