Esempio n. 1
0
        /// <summary>
        /// Raise the level of the edge, optionally inserting into higher level trees
        /// </summary>
        public void RaiseLevel()
        {
            // Update position in edge lists
            source.RemoveEdge(this);
            dest.RemoveEdge(this);
            level++;
            EdgeListUtility.InsertEdge(source.adjacent, this);
            EdgeListUtility.InsertEdge(dest.adjacent, this);

            // Update flags for s
            if (source.euler.Count <= level)
            {
                source.euler.Add(EulerVertex <DynamicNode <T> > .Create(source));
            }
            var es = source.euler[level];

            es.SetFlag(true);

            // Update flags for t
            if (dest.euler.Count <= level)
            {
                dest.euler.Add(EulerVertex <DynamicNode <T> > .Create(dest));
            }
            var et = dest.euler[level];

            et.SetFlag(true);

            // If the edge is already part of a spanning tree, relink them in the next level
            if (euler != null)
            {
                euler.Add(es.Link(et, this));
            }
        }
Esempio n. 2
0
        public DynamicEdge <T> Link(DynamicVertex <T> other, T value)
        {
            var e = new DynamicEdge <T>(value, KeyCounter, this, other);

            KeyCounter++;
            if (!euler[0].IsConnected(other.euler[0]))
            {
                e.LinkSpanningForests();
            }
            euler[0].SetFlag(true);
            other.euler[0].SetFlag(true);
            EdgeListUtility.InsertEdge(adjacent, e);
            EdgeListUtility.InsertEdge(other.adjacent, e);
            return(e);
        }