示例#1
0
    }   // End of AddEdge()

    // Removes the edge if presents.
    public override void RemoveEdge(int from, int to)
    {
        if ((from >= this.nodes.Count) || (to >= this.nodes.Count))
        {
            ErrorPrinter.PrintError("SparseGraph", "RemoveEdge", "THE INVALID EDGE BETWEEN from: " + from + " to: " + to, "Cihan");
        }
        else
        {
            EdgeCommons.RemoveFromLinkedList <EdgeType>(this.edges, from, to);
        }
    }
示例#2
0
    }   // End of AddEdge()

    // Removes the edge if presents.
    public override void RemoveEdge(int from, int to)
    {
        if ((from >= this.nodes.Count) || (to >= this.nodes.Count))
        {
            ErrorPrinter.PrintError("SparseGraph", "RemoveEdge", "THE INVALID EDGE BETWEEN from: " + from + " to: " + to, "Cihan");
            return;
        }

        if (from > to)
        {
            HelperMethods.Swap <int>(ref from, ref to);
        }

        EdgeCommons.RemoveFromLinkedList <EdgeType>(this.edges, from, to);

        // Remove from adjacency list too
        adjacencyList[from].Remove(to);
        adjacencyList[to].Remove(from);
    }