DijkstraTest.php 711 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. use Fhaculty\Graph\Graph;
  3. use Fhaculty\Graph\Vertex;
  4. use Graphp\Algorithms\ShortestPath\Dijkstra;
  5. class DijkstraTest extends BaseShortestPathTest
  6. {
  7. protected function createAlg(Vertex $vertex)
  8. {
  9. return new Dijkstra($vertex);
  10. }
  11. /**
  12. * @expectedException UnexpectedValueException
  13. */
  14. public function testGraphParallelNegative()
  15. {
  16. // 1 -[10]-> 2
  17. // 1 -[-1]-> 2
  18. $graph = new Graph();
  19. $v1 = $graph->createVertex(1);
  20. $v2 = $graph->createVertex(2);
  21. $e1 = $v1->createEdgeTo($v2)->setWeight(10);
  22. $e2 = $v1->createEdgeTo($v2)->setWeight(-1);
  23. $alg = $this->createAlg($v1);
  24. $alg->getEdges();
  25. }
  26. }