src/Budkit/Datastore/Model/Graph.php
public function removeEdge(&$head, &$tail, $directed = TRUE)
    {

        if (!is_a($head, "\Platform\Graph\Node") || !is_a($tail, "\Platform\Graph\Node")) {
            throw new \Platform\Exception("Nodes used to create a new Edge must be instances of \Platform\Graph\Node", PLATFORM_ERROR);
        }
        $_nodeIds = array($head->getId(), $tail->getId());
        $edges = $this->edgeSet;
        //find all edges with these two nodes incident
        foreach ($edges as $edge):
            echo $edge->getId() . "<br />";
            if (in_array($edge->getHead()->getId(), $_nodeIds) && in_array($edge->getTail()->getId(), $_nodeIds)):
                if (!$directed):
                    unset($this->edgeSet[$edge->getId()]);
                elseif ($edge->getHead()->getId() == reset($_nodeIds) && $edge->getTail()->getId() == end($_nodeIds)):
                    //Remove the value from the arcSet array
                    $this->arcSet = array_diff($this->arcSet, array($edge->getId()));
                    unset($this->edgeSet[$edge->getId()]);
                endif;
            endif;
        endforeach;

        return true;
    }
public function removeEdge(&$head, &$tail, $directed = TRUE)
    {

        if (!is_a($head, "\Platform\Graph\Node") || !is_a($tail, "\Platform\Graph\Node")) {
            throw new \Platform\Exception("Nodes used to create a new Edge must be instances of \Platform\Graph\Node", PLATFORM_ERROR);
        }
        $_nodeIds = array($head->getId(), $tail->getId());
        $edges = $this->edgeSet;
        //find all edges with these two nodes incident
        foreach ($edges as $edge):
            echo $edge->getId() . "<br />";
            if (in_array($edge->getHead()->getId(), $_nodeIds) && in_array($edge->getTail()->getId(), $_nodeIds)):
                if (!$directed):
                    unset($this->edgeSet[$edge->getId()]);
                elseif ($edge->getHead()->getId() == reset($_nodeIds) && $edge->getTail()->getId() == end($_nodeIds)):
                    //Remove the value from the arcSet array
                    $this->arcSet = array_diff($this->arcSet, array($edge->getId()));
                    unset($this->edgeSet[$edge->getId()]);
                endif;
            endif;
        endforeach;

        return true;
    }
public function removeEdge ( & $ head , & $ tail , $ directed = TRUE ) { if ( ! is_a ( $ head , "\Platform\Graph\Node" ) || ! is_a ( $ tail , "\Platform\Graph\Node" ) ) { throw new \ Platform \ Exception ( "Nodes used to create a new Edge must be instances of \Platform\Graph\Node" , PLATFORM_ERROR ) ; } $ _nodeIds = array ( $ head -> getId ( ) , $ tail -> getId ( ) ) ; $ edges = $ this -> edgeSet ; //find all edges with these two nodes incident foreach ( $ edges as $ edge ) : echo $ edge -> getId ( ) . "<br />" ; if ( in_array ( $ edge -> getHead ( ) -> getId ( ) , $ _nodeIds ) && in_array ( $ edge -> getTail ( ) -> getId ( ) , $ _nodeIds ) ) : if ( ! $ directed ) : unset ( $ this -> edgeSet [ $ edge -> getId ( ) ] ) ; elseif ( $ edge -> getHead ( ) -> getId ( ) == reset ( $ _nodeIds ) && $ edge -> getTail ( ) -> getId ( ) == end ( $ _nodeIds ) ) : //Remove the value from the arcSet array $ this -> arcSet = array_diff ( $ this -> arcSet , array ( $ edge -> getId ( ) ) ) ; unset ( $ this -> edgeSet [ $ edge -> getId ( ) ] ) ; endif ; endif ; endforeach ; return true ; }
Removes an Edge from the graph. Use removeArc to remove directed edges

@param type $head
@param type $tail
@param type $directed if false, will remove all incident edges of the kind head-tail or tail-head
@return boolean
@throws \Platform\Exception
Removes an Edge from the graph . Use removeArc to remove directed edges