예제 #1
0
파일: LoopTest.php 프로젝트: feffi/graph
 public function testGraphDirectedLoop()
 {
     // 1 -> 1
     $graph = new Graph();
     $graph->createVertex(1)->createEdgeTo($v1 = $graph->getVertex(1));
     $alg = new AlgorithmLoop($graph);
     $this->assertTrue($alg->hasLoop());
     $this->assertTrue($alg->hasLoopVertex($v1));
 }
예제 #2
0
 /**
  * checks whether this walk HAS a loop (single edge connecting vertex A with vertex A again)
  *
  * The following Walk is NOT a valid loop, but it contains a valid loop:
  *
  *      /->3
  *      |
  * 1 -> 2 -\
  *      ^  |
  *      \--/
  *
  * @return boolean
  * @uses AlgorithmLoop::hasLoop()
  * @see self::isLoop()
  */
 public function hasLoop()
 {
     $alg = new AlgorithmLoop($this->walk);
     return $alg->hasLoop();
 }