Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="de"></param>
        private void CopySymDepths(DirectedEdge de)
        {
            DirectedEdge sym = de.Sym;

            sym.SetDepth(Positions.Left, de.GetDepth(Positions.Right));
            sym.SetDepth(Positions.Right, de.GetDepth(Positions.Left));
        }
Esempio n. 2
0
        private void ComputeNodeDepth(Node n, DirectedEdge startEdge)
        {
            if (startEdge.Visited)
            {
                return;
            }

            ((DirectedEdgeStar)n.Edges).ComputeDepths(startEdge);

            // copy depths to sym edges
            //for (Iterator i = ((DirectedEdgeStar) n.getEdges()).iterator(); i.hasNext(); )
            foreach (object obj in n.Edges)
            {
                DirectedEdge de = (DirectedEdge)obj;                 // i.next();
                de.Visited = true;
                DirectedEdge sym = de.Sym;
                sym.SetDepth(Position.Left, de.GetDepth(Position.Right));
                sym.SetDepth(Position.Right, de.GetDepth(Position.Left));
            }
            // propagate depth to all linked nodes via the sym edges
            // If a sym edge has been visited already, there is no need to process it further
            //for (Iterator i = ((DirectedEdgeStar) n.getEdges()).iterator(); i.hasNext(); )
            foreach (object obj in n.Edges)
            {
                DirectedEdge de      = (DirectedEdge)obj;
                DirectedEdge sym     = de.Sym;
                Node         symNode = sym.Node;

                // NOTE: this is a depth-first traversal of the graph.
                // This will cause a large depth of recursion.
                // It might be better to do a breadth-first traversal.
                ComputeNodeDepth(symNode, sym);
            }
        }