Exemplo n.º 1
0
 /**
  * @param Graph\Vertex $source
  * @param Graph\Vertex $target
  * @return Graph\Edge
  */
 public function create_edge(Graph\Vertex $source, Graph\Vertex $target)
 {
     $edge = new Graph\Edge\DirectedEdge($source, $target);
     $source->add_outgoing_edge($edge);
     $target->add_incoming_edge($edge);
     return $edge;
 }
Exemplo n.º 2
0
 public function testAddIncomingEdge()
 {
     $vertex = new Graph\Vertex('A');
     $edge = new Graph\Edge\DirectedEdge(new Graph\Vertex('A'), new Graph\Vertex('B'));
     $vertex->add_incoming_edge($edge);
     $this->assertTrue($vertex->incoming_edges->contains($edge));
 }