Ejemplo n.º 1
0
        /// <summary>
        /// Removes a node from the graph, along with any associated DirectedEdges and
        /// Edges.
        /// </summary>
        /// <param name="node"></param>
        public virtual void Remove(Node node)
        {
            // unhook all directed edges
            IList 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)
                {
                    _edges.Remove(edge);
                }
            }
            // remove the node from the graph
            _nodeMap.Remove(node.Coordinate);
            node.Remove();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes a node from the graph, along with any associated DirectedEdges and
        /// Edges.
        /// </summary>
        /// <param name="node"></param>
        public virtual void Remove(Node node)
        {
            // unhook all directed edges
            IList 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)
                    _edges.Remove(edge);
            }
            // remove the node from the graph
            _nodeMap.Remove(node.Coordinate);
            node.Remove();
        }