private function mergeParallelEdges(Edge $newEdge)
    {
        $parallelEdges = $newEdge->getEdgesParallel();
        if ($parallelEdges) {

            $mergedCapacity = 0;

            foreach ($parallelEdges as $parallelEdge) {
                $mergedCapacity += $parallelEdge->getCapacity();
            }

            $newEdge->setCapacity($newEdge->getCapacity() + $mergedCapacity);

            foreach ($parallelEdges as $parallelEdge) {
                $parallelEdge->destroy();
            }
        }
    }
private function mergeParallelEdges(Edge $newEdge)
    {
        $parallelEdges = $newEdge->getEdgesParallel();
        if ($parallelEdges) {

            $mergedCapacity = 0;

            foreach ($parallelEdges as $parallelEdge) {
                $mergedCapacity += $parallelEdge->getCapacity();
            }

            $newEdge->setCapacity($newEdge->getCapacity() + $mergedCapacity);

            foreach ($parallelEdges as $parallelEdge) {
                $parallelEdge->destroy();
            }
        }
    }
private function mergeParallelEdges ( Edge $ newEdge ) { $ parallelEdges = $ newEdge -> getEdgesParallel ( ) ; if ( $ parallelEdges ) { $ mergedCapacity = 0 ; foreach ( $ parallelEdges as $ parallelEdge ) { $ mergedCapacity += $ parallelEdge -> getCapacity ( ) ; } $ newEdge -> setCapacity ( $ newEdge -> getCapacity ( ) + $ mergedCapacity ) ; foreach ( $ parallelEdges as $ parallelEdge ) { $ parallelEdge -> destroy ( ) ; } } }
Will merge all edges that are parallel to to given edge

@param Edge $newEdge
Will merge all edges that are parallel to to given edge