/**
  * @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;
 }
Exemple #2
0
 public function testAddOutgoingEdge()
 {
     $vertex = new Graph\Vertex('A');
     $edge = new Graph\Edge\DirectedEdge(new Graph\Vertex('A'), new Graph\Vertex('B'));
     $vertex->add_outgoing_edge($edge);
     $this->assertTrue($vertex->outgoing_edges->contains($edge));
 }
 /**
  * Constructor
  *
  * @param Graph\Vertex $vertex the vertex that caused this error
  */
 public function __construct(Graph\Vertex $vertex)
 {
     parent::__construct($vertex->__toString());
 }
Exemple #4
0
 /**
  * PHP 5>=5.4.0 Implementation
  * @param Vertex $object
  *
  * @return mixed|string
  */
 public function getHash($object)
 {
     return $object->__toString();
 }