Skip to content

Commit 3554405

Browse files
committed
Fix getting parallel undirected edges
1 parent 924e12c commit 3554405

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Parallel.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Fhaculty\Graph\Algorithm\BaseGraph;
66
use Fhaculty\Graph\Edge\Base as Edge;
77
use Fhaculty\Graph\Edge\Directed as DirectedEdge;
8+
use Fhaculty\Graph\Set\Edges;
89
use Fhaculty\Graph\Graph;
910
use LogicException;
1011

@@ -49,9 +50,10 @@ public function hasEdgeParallelEdge(Edge $edge)
4950
}
5051

5152
/**
52-
* get all edges parallel to this edge (excluding self)
53+
* get set of all Edges parallel to this edge (excluding self)
5354
*
54-
* @return Edge[]
55+
* @param Edge $edge
56+
* @return Edges
5557
* @throws LogicException
5658
*/
5759
public function getEdgesParallelEdge(Edge $edge)
@@ -63,7 +65,7 @@ public function getEdgesParallelEdge(Edge $edge)
6365
// edge points into both directions (undirected/bidirectional edge)
6466
// also get all edges in other direction
6567
$ends = $edge->getVertices();
66-
$edges = $ends[0]->getEdges()->getEdgesIntersection($ends[1]->getEdges())->getVector();
68+
$edges = $ends->getVertexFirst()->getEdges()->getEdgesIntersection($ends->getVertexLast()->getEdges())->getVector();
6769
}
6870

6971
$pos = array_search($edge, $edges, true);

0 commit comments

Comments
 (0)