Ejemplo n.º 1
0
        /// <summary>
        /// Removes a node from the graph, along with any associated DirectedEdges and Edges.
        /// </summary>
        public void Remove(Node node)
        {
            // unhook all directed edges
            ArrayList outEdges = node.OutEdges.Edges;

            for (IEnumerator i = outEdges.GetEnumerator(); i.MoveNext();)
            {
                DirectedEdge de  = (DirectedEdge)i.Current;
                DirectedEdge sym = de.Sym;
                // remove the diredge that points to this node
                if (sym != null)
                {
                    Remove(sym);
                }
                // remove this diredge from the graph collection
                dirEdges.Remove(de);

                Edge edge = de.Edge;
                if (edge != null)
                {
                    m_arrEdges.Remove(edge);
                }
            }

            // remove the node from the graph
            nodeMap.Remove(node.Coordinate);
            node.Remove();
        }