Skip to content

Commit 7afe56d

Browse files
committed
Each getVertices*() method returns a Set\Vertices instance
1 parent 72b6404 commit 7afe56d

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/Bipartit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getColors()
6565
$nextColor = 1-$color;
6666

6767
// scan all vertices connected to this vertex
68-
foreach ($vertex->getVerticesEdge() as $vid => $nextVertex) {
68+
foreach ($vertex->getVerticesEdge()->getMap() as $vid => $nextVertex) {
6969
// color unknown, so expect next color for this vertex
7070
if (!isset($colors[$vid])) {
7171
$colors[$vid] = $nextColor;

src/Search/BreadthFirst.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ public function getVertices()
2727
$visited[$t->getId()]= $t;
2828

2929
// get next vertices
30-
$vertices = $this->getVerticesAdjacent($t);
31-
foreach ($vertices as $id => $vertex) {
32-
// if not "toughed" before
30+
foreach ($this->getVerticesAdjacent($t)->getMap() as $id => $vertex) {
31+
// if not "touched" before
3332
if (!isset($mark[$id])) {
3433
// add to queue
3534
$queue[] = $vertex;

src/Search/DepthFirst.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function iterativeDepthFirstSearch(Vertex $vertex)
4040
if (!isset($visited[$vertex->getId()])) {
4141
$visited[$vertex->getId()] = $vertex;
4242

43-
foreach (array_reverse($this->getVerticesAdjacent($vertex), true) as $vid => $nextVertex) {
43+
foreach (array_reverse($this->getVerticesAdjacent($vertex)->getMap(), true) as $vid => $nextVertex) {
4444
$todo[] = $nextVertex;
4545
}
4646
}

0 commit comments

Comments
 (0)