Skip to content

Commit c9cb932

Browse files
clueChristian Lück
authored andcommitted
Update references to Graph::getVertexFirst()
1 parent e6458fa commit c9cb932

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

src/ConnectedComponents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private function createSearch(Vertex $vertex)
7070
public function isSingle()
7171
{
7272
try {
73-
$vertex = $this->graph->getVertexFirst();
73+
$vertex = $this->graph->getVertices()->getVertexFirst();
7474
}
7575
catch (UnderflowException $e) {
7676
// no first vertex => empty graph => has zero components

src/Degree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Degree extends BaseGraph
3131
public function getDegree()
3232
{
3333
// get initial degree of any start vertex to compare others to
34-
$degree = $this->getDegreeVertex($this->graph->getVertexFirst());
34+
$degree = $this->getDegreeVertex($this->graph->getVertices()->getVertexFirst());
3535

3636
foreach ($this->graph->getVertices() as $vertex) {
3737
/** @var $vertex Vertex */

src/TravelingSalesmanProblem/Bruteforce.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public function setUpperLimitMst()
9292

9393
protected function getVertexStart()
9494
{
95-
return $this->graph->getVertexFirst();
95+
// actual start doesn't really matter as we're only considering complete graphs here
96+
return $this->graph->getVertices()->getVertexFirst();
9697
}
9798

9899
protected function getGraph()
@@ -116,8 +117,7 @@ public function getEdges()
116117
// numEdges 3-12 should work
117118

118119
$this->bestWeight = $this->upperLimit;
119-
// actual start doesn't really matter as we're only considering complete graphs here
120-
$this->startVertex = $this->graph->getVertexFirst();
120+
$this->startVertex = $this->getVertexStart();
121121

122122
$result = $this->step($this->startVertex,
123123
0,

src/TravelingSalesmanProblem/MinimumSpanningTree.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(Graph $inputGraph)
2323

2424
protected function getVertexStart()
2525
{
26-
return $this->graph->getVertexFirst();
26+
return $this->graph->getVertices()->VertexFirst();
2727
}
2828

2929
protected function getGraph()
@@ -43,7 +43,7 @@ public function getEdges()
4343
$minimumSpanningTreeAlgorithm = new MstKruskal($this->graph);
4444
$minimumSpanningTree = $minimumSpanningTreeAlgorithm->createGraph();
4545

46-
$alg = new SearchDepthFirst($minimumSpanningTree->getVertexFirst());
46+
$alg = new SearchDepthFirst($minimumSpanningTree->getVertices()->getVertexFirst());
4747
// Depth first search in minmum spanning tree (for the eulerian path)
4848

4949
$startVertex = NULL;

src/Tree/Undirected.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Undirected extends Tree
5050
*
5151
* @return boolean
5252
* @uses Vertices::isEmpty() to skip null Graphs (a Graph with no Vertices is *NOT* a valid tree)
53-
* @uses Graph::getVertexFirst() to get get get random "root" Vertex to start search from
53+
* @uses Vertices::getVertexFirst() to get get get random "root" Vertex to start search from
5454
* @uses self::getVerticesSubtreeRecursive() to count number of vertices connected to root
5555
*/
5656
public function isTree()
@@ -60,7 +60,7 @@ public function isTree()
6060
}
6161

6262
// every vertex can represent a root vertex, so just pick one
63-
$root = $this->graph->getVertexFirst();
63+
$root = $this->graph->getVertices()->getVertexFirst();
6464

6565
$vertices = array();
6666
try {

tests/Tree/BaseDirectedTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testEmptyGraphDoesNotHaveHeight(BaseDirected $tree)
7575
public function testGraphTree()
7676
{
7777
$graph = $this->createGraphTree();
78-
$root = $graph->getVertexFirst();
78+
$root = $graph->getVertices()->getVertexFirst();
7979

8080
$nonRoot = $graph->getVertices()->getMap();
8181
unset($nonRoot[$root->getId()]);

0 commit comments

Comments
 (0)