Skip to content

Commit 59845d3

Browse files
committed
Cope with duplicate vertices from Vertex::getVerticesEdge*()
1 parent 6c2cb6a commit 59845d3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Tree/InTree.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InTree extends DirectedTree
2525
public function getVerticesChildren(Vertex $vertex)
2626
{
2727
$vertices = $vertex->getVerticesEdgeFrom();
28-
if (count($vertices) !== $this->degree->getDegreeInVertex($vertex)) {
28+
if ($vertices->hasDuplicates()) {
2929
throw new UnexpectedValueException();
3030
}
3131

@@ -35,7 +35,7 @@ public function getVerticesChildren(Vertex $vertex)
3535
protected function getVerticesParent(Vertex $vertex)
3636
{
3737
$vertices = $vertex->getVerticesEdgeTo();
38-
if (count($vertices) !== $this->degree->getDegreeOutVertex($vertex)) {
38+
if ($vertices->hasDuplicates()) {
3939
throw new UnexpectedValueException();
4040
}
4141

src/Tree/OutTree.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class OutTree extends DirectedTree
2525
public function getVerticesChildren(Vertex $vertex)
2626
{
2727
$vertices = $vertex->getVerticesEdgeTo();
28-
if (count($vertices) !== $this->degree->getDegreeOutVertex($vertex)) {
28+
if ($vertices->hasDuplicates()) {
2929
throw new UnexpectedValueException();
3030
}
3131

@@ -35,7 +35,7 @@ public function getVerticesChildren(Vertex $vertex)
3535
protected function getVerticesParent(Vertex $vertex)
3636
{
3737
$vertices = $vertex->getVerticesEdgeFrom();
38-
if (count($vertices) !== $this->degree->getDegreeInVertex($vertex)) {
38+
if ($vertices->hasDuplicates()) {
3939
throw new UnexpectedValueException();
4040
}
4141

0 commit comments

Comments
 (0)