getReversed() 공개 메소드

Build the reversed digraph of this digraph
public getReversed ( ) : Digraph
리턴 Digraph
예제 #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');
 }