예제 #1
0
 /**
  * Filters the graph so that only entities connected to the root are left
  *
  * Should be run after you've added some set of associations with from()
  *
  * @return void
  */
 public function filterConnected()
 {
     $alg = new BreadthFirst($this->graph->getVertex($this->root));
     $alg->setDirection(BreadthFirst::DIRECTION_REVERSE);
     $vertices = $alg->getVertices();
     $this->graph = $this->graph->createGraphCloneVertices($vertices);
 }
예제 #2
0
 /**
  *
  * @param Vertex $vertex
  * @return SearchBreadthFirst
  */
 private function createSearch(Vertex $vertex)
 {
     $alg = new SearchBreadthFirst($vertex);
     // follow into both directions (loosely connected)
     return $alg->setDirection(SearchBreadthFirst::DIRECTION_BOTH);
 }