Пример #1
0
        //public GraphLinkedList<NAME> LeftContour(Vertex<NAME> v)
        //{
        //    // Create a graph with the left contour of v.
        //    GraphLinkedList<NAME> lc = new GraphLinkedList<NAME>();

        //    // Create left contour.
        //    int llevel = 1;
        //    Vertex<NAME> left = v.GetLeftMost(0, llevel);
        //    Vertex<NAME> cloneleft = lc.CloneVertex(v);
        //    Vertex<NAME> llast = v;
        //    Vertex<NAME> clonellast = cloneleft;
        //    while (left != null)
        //    {
        //        cloneleft = lc.CloneVertex((Vertex<NAME>)left);
        //        lc.AddEdge(clonellast, cloneleft);

        //        llevel++;
        //        llast = left;
        //        clonellast = cloneleft;
        //        left = v.GetLeftMost(0, llevel);
        //    }

        //    return lc;
        //}

        //public GraphLinkedList<NAME> RightContour(Vertex<NAME> v)
        //{
        //    // Create a graph with the right contour of v.
        //    GraphLinkedList<NAME> rc = new GraphLinkedList<NAME>();

        //    rc.CloneVertex(v);

        //    // Create right contour.
        //    int rlevel = 1;
        //    Vertex<NAME> right = v.GetRightMost(0, rlevel);
        //    Vertex<NAME> cloneright = rc.CloneVertex(v);
        //    Vertex<NAME> rlast = v;
        //    Vertex<NAME> clonerlast = cloneright;
        //    while (right != null)
        //    {
        //        cloneright = rc.CloneVertex((Vertex<NAME>)right);
        //        rc.AddEdge(clonerlast, cloneright);

        //        rlevel++;
        //        rlast = right;
        //        clonerlast = cloneright;
        //        right = v.GetRightMost(0, rlevel);
        //    }
        //    return rc;
        //}

        int height(GraphLinkedList <NAME, NODE, EDGE> .Vertex v, int d)
        {
            if (v == null)
            {
                return(d);
            }
            int m = d;

            foreach (Edge e in v._Successors)
            {
                GraphLinkedList <NAME, NODE, EDGE> .Vertex u = e.to;
                int x = this.height(u, d + 1);
                if (x > m)
                {
                    m = x;
                }
            }
            return(m);
        }
Пример #2
0
 public ReverseSuccessorEnumerator(GraphLinkedList <NAME, NODE, EDGE> g, NAME n)
 {
     graph = g;
     name  = n;
 }
Пример #3
0
 public PredecessorEnumerator(GraphLinkedList <NAME, NODE, EDGE> g, NAME n)
 {
     graph = g;
     name  = n;
 }
Пример #4
0
        virtual public GraphLinkedList <NAME, NODE, EDGE> .Edge AddEdge(GraphLinkedList <NAME, NODE, EDGE> .Vertex f, GraphLinkedList <NAME, NODE, EDGE> .Vertex t)
        {
            EDGE edge = new EDGE();

            edge.from = f;
            edge.to   = t;
            //Edge edge = new Edge((Vertex)f, (Vertex)t);
            edge.from._Successors.Add(edge);
            edge.to._Predecessors.Add(edge);
            return(edge);
        }
Пример #5
0
 public Edge(GraphLinkedList <NAME, NODE, EDGE> .Vertex f, GraphLinkedList <NAME, NODE, EDGE> .Vertex t)
 {
     from = f;
     to   = t;
 }