Gliph\Graph\DirectedAdjacencyList::ensureArc PHP Метод

ensureArc() публичный Метод

public ensureArc ( $tail, $head )
    public function ensureArc($tail, $head)
    {
        $this->ensureVertex($tail)->ensureVertex($head);
        if (!$this->vertices[$tail]->contains($head)) {
            $this->size++;
        }
        $this->vertices[$tail]->attach($head);
    }

Usage Example

Пример #1
0
 /**
  * @covers ::generateText
  * @covers ::convertGraph
  */
 public function testGenerateText()
 {
     $a = new DummyVertex('a');
     $b = new DummyVertex('b');
     $c = new DummyVertex('c');
     $graph = new DirectedAdjacencyList();
     $graph->ensureArc($a, $b);
     $graph->ensureArc($b, $c);
     $graph->ensureArc($c, $b);
     $printer = new GraphPrinter();
     $this->assertContains('node_0', $printer->generateText($graph));
 }
All Usage Examples Of Gliph\Graph\DirectedAdjacencyList::ensureArc