File tree Expand file tree Collapse file tree 6 files changed +10
-10
lines changed Expand file tree Collapse file tree 6 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ private function createSearch(Vertex $vertex)
70
70
public function isSingle ()
71
71
{
72
72
try {
73
- $ vertex = $ this ->graph ->getVertexFirst ();
73
+ $ vertex = $ this ->graph ->getVertices ()-> getVertexFirst ();
74
74
}
75
75
catch (UnderflowException $ e ) {
76
76
// no first vertex => empty graph => has zero components
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class Degree extends BaseGraph
31
31
public function getDegree ()
32
32
{
33
33
// 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 ());
35
35
36
36
foreach ($ this ->graph ->getVertices () as $ vertex ) {
37
37
/** @var $vertex Vertex */
Original file line number Diff line number Diff line change @@ -92,7 +92,8 @@ public function setUpperLimitMst()
92
92
93
93
protected function getVertexStart ()
94
94
{
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 ();
96
97
}
97
98
98
99
protected function getGraph ()
@@ -116,8 +117,7 @@ public function getEdges()
116
117
// numEdges 3-12 should work
117
118
118
119
$ 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 ();
121
121
122
122
$ result = $ this ->step ($ this ->startVertex ,
123
123
0 ,
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function __construct(Graph $inputGraph)
23
23
24
24
protected function getVertexStart ()
25
25
{
26
- return $ this ->graph ->getVertexFirst ();
26
+ return $ this ->graph ->getVertices ()-> VertexFirst ();
27
27
}
28
28
29
29
protected function getGraph ()
@@ -43,7 +43,7 @@ public function getEdges()
43
43
$ minimumSpanningTreeAlgorithm = new MstKruskal ($ this ->graph );
44
44
$ minimumSpanningTree = $ minimumSpanningTreeAlgorithm ->createGraph ();
45
45
46
- $ alg = new SearchDepthFirst ($ minimumSpanningTree ->getVertexFirst ());
46
+ $ alg = new SearchDepthFirst ($ minimumSpanningTree ->getVertices ()-> getVertexFirst ());
47
47
// Depth first search in minmum spanning tree (for the eulerian path)
48
48
49
49
$ startVertex = NULL ;
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ class Undirected extends Tree
50
50
*
51
51
* @return boolean
52
52
* @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
54
54
* @uses self::getVerticesSubtreeRecursive() to count number of vertices connected to root
55
55
*/
56
56
public function isTree ()
@@ -60,7 +60,7 @@ public function isTree()
60
60
}
61
61
62
62
// every vertex can represent a root vertex, so just pick one
63
- $ root = $ this ->graph ->getVertexFirst ();
63
+ $ root = $ this ->graph ->getVertices ()-> getVertexFirst ();
64
64
65
65
$ vertices = array ();
66
66
try {
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function testEmptyGraphDoesNotHaveHeight(BaseDirected $tree)
75
75
public function testGraphTree ()
76
76
{
77
77
$ graph = $ this ->createGraphTree ();
78
- $ root = $ graph ->getVertexFirst ();
78
+ $ root = $ graph ->getVertices ()-> getVertexFirst ();
79
79
80
80
$ nonRoot = $ graph ->getVertices ()->getMap ();
81
81
unset($ nonRoot [$ root ->getId ()]);
You can’t perform that action at this time.
0 commit comments