Example #1
0
 public function addOutEdgeTo(Vertex $vertex, $weight = 1)
 {
     $edge = new Edge($this, $vertex, $weight);
     $this->outEdges[] = $edge;
     $vertex->inEdges[] = $edge;
     $this->graph->addEdge($edge);
     if (!$this->graph->directed) {
         $edge = new Edge($vertex, $this, $weight);
         $vertex->outEdges[] = $edge;
         $this->inEdges[] = $edge;
         $this->graph->addEdge($edge);
     }
 }