示例#1
0
 /**
  * @expectedException UnexpectedValueException
  */
 public function testFailCycle()
 {
     $graph = new Graph();
     $graph->createVertex(1)->createEdgeTo($graph->createVertex(2));
     $graph->getVertex(2)->createEdgeTo($graph->getVertex(1));
     $alg = new TopologicalSort($graph);
     $alg->getVertices();
 }
示例#2
0
 /**
  * Performs a topological sort
  *
  * @return \Fhaculty\Graph\Set\Vertices
  */
 public function topologicalSort()
 {
     $sort = new TopologicalSort($this->graph);
     return $sort->getVertices();
 }