58 $this->_graph->addNode($node1);
59 $this->_graph->addNode($node2);
60 $node1->connectTo($node2);
62 $node =& $this->_graph->getNodes();
64 $node = $node->getNeighbours();
72 $this->assertTrue($node2);
74 $this->assertFalse($node2);
115 $this->_graph->addNode($node[0]);
116 $this->_graph->addNode($node[1]);
117 $this->_graph->addNode($node[2]);
118 $this->assertEquals(0, $node[0]->inDegree(),
'inDegree test failed for node 0 with 0 arcs');
119 $this->assertEquals(0, $node[1]->inDegree(),
'inDegree test failed for node 1 with 0 arcs');
120 $this->assertEquals(0, $node[2]->inDegree(),
'inDegree test failed for node 2 with 0 arcs');
121 $this->assertEquals(0, $node[0]->outDegree(),
'outDegree test failed for node 0 with 0 arcs');
122 $this->assertEquals(0, $node[1]->outDegree(),
'outDegree test failed for node 1 with 0 arcs');
123 $this->assertEquals(0, $node[2]->outDegree(),
'outDegree test failed for node 2 with 0 arcs');
124 $node[0]->connectTo($node[1]);
125 $this->assertEquals(0, $node[0]->inDegree(),
'inDegree test failed for node 0 with 1 arc');
126 $this->assertEquals(1, $node[1]->inDegree(),
'inDegree test failed for node 1 with 1 arc');
127 $this->assertEquals(0, $node[2]->inDegree(),
'inDegree test failed for node 2 with 1 arc');
128 $this->assertEquals(1, $node[0]->outDegree(),
'outDegree test failed for node 0 with 1 arc');
129 $this->assertEquals(0, $node[1]->outDegree(),
'outDegree test failed for node 1 with 1 arc');
130 $this->assertEquals(0, $node[2]->outDegree(),
'outDegree test failed for node 2 with 1 arc');
131 $node[0]->connectTo($node[2]);
132 $this->assertEquals(0, $node[0]->inDegree(),
'inDegree test failed for node 0 with 2 arcs');
133 $this->assertEquals(1, $node[1]->inDegree(),
'inDegree test failed for node 1 with 2 arcs');
134 $this->assertEquals(1, $node[2]->inDegree(),
'inDegree test failed for node 2 with 2 arcs');
135 $this->assertEquals(2, $node[0]->outDegree(),
'outDegree test failed for node 0 with 2 arcs');
136 $this->assertEquals(0, $node[1]->outDegree(),
'outDegree test failed for node 1 with 2 arcs');
137 $this->assertEquals(0, $node[2]->outDegree(),
'outDegree test failed for node 2 with 2 arcs');
146 $this->_graph->addNode($node[0]);
147 $this->_graph->addNode($node[1]);
148 $this->_graph->addNode($node[2]);
149 $this->assertEquals(0, $node[0]->inDegree(),
'inDegree test failed for node 0 with 0 arcs');
150 $this->assertEquals(0, $node[1]->inDegree(),
'inDegree test failed for node 1 with 0 arcs');
151 $this->assertEquals(0, $node[2]->inDegree(),
'inDegree test failed for node 2 with 0 arcs');
152 $this->assertEquals(0, $node[0]->outDegree(),
'outDegree test failed for node 0 with 0 arcs');
153 $this->assertEquals(0, $node[1]->outDegree(),
'outDegree test failed for node 1 with 0 arcs');
154 $this->assertEquals(0, $node[2]->outDegree(),
'outDegree test failed for node 2 with 0 arcs');
155 $node[0]->connectTo($node[1]);
156 $this->assertEquals(1, $node[0]->inDegree(),
'inDegree test failed for node 0 with 1 arc');
157 $this->assertEquals(1, $node[1]->inDegree(),
'inDegree test failed for node 1 with 1 arc');
158 $this->assertEquals(0, $node[2]->inDegree(),
'inDegree test failed for node 2 with 1 arc');
159 $this->assertEquals(1, $node[0]->outDegree(),
'outDegree test failed for node 0 with 1 arc');
160 $this->assertEquals(1, $node[1]->outDegree(),
'outDegree test failed for node 1 with 1 arc');
161 $this->assertEquals(0, $node[2]->outDegree(),
'outDegree test failed for node 2 with 1 arc');
162 $node[0]->connectTo($node[2]);
163 $this->assertEquals(2, $node[0]->inDegree(),
'inDegree test failed for node 0 with 2 arcs');
164 $this->assertEquals(1, $node[1]->inDegree(),
'inDegree test failed for node 1 with 2 arcs');
165 $this->assertEquals(1, $node[2]->inDegree(),
'inDegree test failed for node 2 with 2 arcs');
166 $this->assertEquals(2, $node[0]->outDegree(),
'outDegree test failed for node 0 with 2 arcs');
167 $this->assertEquals(1, $node[1]->outDegree(),
'outDegree test failed for node 1 with 2 arcs');
168 $this->assertEquals(1, $node[2]->outDegree(),
'outDegree test failed for node 2 with 2 arcs');