Example #1
0
 /**
  * Inserts the given edge into this graph.
  *
  * @param object Edge $edge The edge to insert.
  */
 protected function insertEdge(Edge $edge)
 {
     $v = $edge->getV0()->getNumber();
     $w = $edge->getV1()->getNumber();
     if ($this->matrix[array($v, $w)] !== NULL) {
         throw new ArgumentError();
     }
     if ($v == $w) {
         throw new ArgumentError();
     }
     $this->matrix[array($v, $w)] = $edge;
     $this->matrix[array($w, $v)] = $edge;
     ++$this->numberOfEdges;
 }
Example #2
0
 /**
  * Inserts the specified edge into this graph.
  *
  * @param object Edge $edge The edge to insert into this graph.
  */
 protected function insertEdge(Edge $edge)
 {
     $v = $edge->getV0()->getNumber();
     $this->adjacencyList[$v]->append($edge);
     /*
     $w = $edge->getV1()->getNumber();
     $this->adjacencyList[$w]->append(
         new Edge($this, $w, $v, $edge->getWeight()));
     */
     ++$this->numberOfEdges;
 }
Example #3
0
 /**
  * Inserts the specified edge into this graph.
  *
  * @param object Edge $edge The edge to insert into this graph.
  */
 protected function insertEdge(Edge $edge)
 {
     $v = $edge->getV0()->getNumber();
     $this->adjacencyList[$v]->append($edge);
     ++$this->numberOfEdges;
 }