Наследование: extends Algorithm
Пример #1
0
 public function testReversed()
 {
     $card = 10;
     for ($k = 0; $k < $card; $k++) {
         $this->graph->addVertex(new Vertex($k));
     }
     $vertex = $this->graph->getVertexSet();
     foreach ($vertex as $idx => $v) {
         // the first vertex is isolated
         for ($k = 0; $k < $idx; $k++) {
             $this->graph->addEdge($v, $vertex[$k]);
         }
     }
     $reversed = $this->graph->getReversed();
     $this->assertCount($card, $reversed->getVertexSet());
     $this->assertCount($card * ($card - 1) / 2, $reversed->getEdgeSet());
     $newGraph = new ReversedDigraph($reversed);
     $origin = $newGraph->getReversed();
     $this->assertEquals($this->graph->getVertexSet(), $origin->getVertexSet());
     $this->assertEquals($this->graph->getEdgeSet(), $origin->getEdgeSet());
 }
Пример #2
0
 /**
  * Add used centrality information on each vertex
  * (edge effect on this digraph)
  */
 public function decorate()
 {
     $reversed = new ReversedDigraph($this->graph);
     $this->addCentralityRank($reversed->getReversed(), 'centrality');
 }