Example #1
0
 protected function findVertex(Graph $g, $type, $name)
 {
     foreach ($g->getVertexSet() as $vertex) {
         if (get_class($vertex) == $type && $vertex->getName() == $name) {
             return $vertex;
         }
     }
     return null;
 }
 protected function assertEdges(array $search, Graph $g)
 {
     $edge = $g->getEdgeSet();
     $this->assertCount(count($search), $edge);
     foreach ($search as $item) {
         $src = $this->findVertex($g, $item[0][0] . 'Vertex', $item[0][1]);
         $this->assertNotNull($src, $item[0][0]);
         $dst = $this->findVertex($g, $item[1][0] . 'Vertex', $item[1][1]);
         $this->assertNotNull($dst, $item[1][0]);
         $e = $g->searchEdge($src, $dst);
         $this->assertNotNull($e, "{$item[0][1]} -> {$item[1][1]}");
     }
 }