2 // 1 -[-1]-> 2 $graph = new Graph(); $v1 = $graph->createVertex(1); $v2 = $graph->createVertex(2); $e1 = $v1->createEdgeTo($v2)->setWeight(10); $e2 = $v1->createEdgeTo($v2)->setWeight(-1); $alg = $this->createAlg($v1); $this->assertEquals(1, $alg->getDistance($v2)); $this->assertEquals(array(2 => 1), $alg->getDistanceMap()); $this->assertEquals(array($e1), $alg->getEdges()->getVector()); $this->assertEquals(array($e1), $alg->getEdgesTo($v2)->getVector()); $this->assertEquals(array(2 => $v2), $alg->getVertices()->getMap()); $this->assertEquals(array(2), $alg->getVertices()->getIds()); } protected function getExpectedWeight($edges) { return count($edges); } }