Skip to content

Commit 3fd5d00

Browse files
committed
Move Vertex::hasLoop() to Algorithm\Loop::hasLoopVertex()
1 parent df4d3e0 commit 3fd5d00

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Loop.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,21 @@ public function hasLoop()
3232

3333
return false;
3434
}
35+
36+
/**
37+
* checks whether this vertex has a loop (edge to itself)
38+
*
39+
* @return boolean
40+
* @uses Edge::isLoop()
41+
*/
42+
public function hasLoopVertex(Vertex $vertex)
43+
{
44+
foreach ($vertex->getEdges() as $edge) {
45+
if ($edge->isLoop()) {
46+
return true;
47+
}
48+
}
49+
50+
return false;
51+
}
3552
}

0 commit comments

Comments
 (0)