Beispiel #1
0
 public VertexWirth(int key, int count, VertexWirth next, EdgeWirth trail)
 {
     Key        = key;
     this.count = count;
     Next       = next;
     Trail      = trail;
 }
Beispiel #2
0
 public VertexWirth(int key, int count, VertexWirth next, EdgeWirth trail, object data = null)
 {
     Key        = key;
     this.count = count;
     Next       = next;
     Trail      = trail;
     Data       = data;
 }
Beispiel #3
0
        public bool DeleteDirectEdge(int from, int to)
        {
            var f = Find(from);

            if (f == null)
            {
                return(false);
            }

            var t = Find(to);

            if (f == null)
            {
                return(false);
            }

            EdgeWirth previous = null;
            var       edge     = f.Trail;

            while (edge.Next != null)
            {
                if (edge.Id.Key == t.Key)
                {
                    var next = edge.Next;
                    if (previous == null)
                    {
                        if (next == null)
                        {
                            f.Trail = null;
                        }
                        else
                        {
                            f.Trail = next;
                        }
                    }
                    else
                    {
                        if (next == null)
                        {
                            previous.Next = null;
                        }
                        else
                        {
                            previous.Next = next;
                        }
                    }
                    return(true);
                }
                previous = edge;
                edge     = edge.Next;
            }
            return(false);
        }
Beispiel #4
0
        private bool DeleteDirectEdge(VertexWirth f, VertexWirth t)
        {
            EdgeWirth previous = null;
            var       edge     = f.Trail;

            while (edge != null)
            {
                if (edge.Id.Key == t.Key)
                {
                    if (!edge.Direct)
                    {
                        return(false);
                    }
                    var next = edge.Next;
                    if (previous == null)
                    {
                        if (next == null)
                        {
                            f.Trail = null;
                        }
                        else
                        {
                            f.Trail = next;
                        }
                    }
                    else
                    {
                        if (next == null)
                        {
                            previous.Next = null;
                        }
                        else
                        {
                            previous.Next = next;
                        }
                    }
                    return(true);
                }
                previous = edge;
                edge     = edge.Next;
            }
            return(false);
        }
Beispiel #5
0
 public EdgeWirth(VertexWirth id, EdgeWirth next, int weight, bool direct) : this(id, next, weight)
 {
     Direct = direct;
 }
Beispiel #6
0
 public EdgeWirth(VertexWirth id, EdgeWirth next, int weight) : this(id, next)
 {
     Weight = weight;
 }
Beispiel #7
0
 public EdgeWirth(VertexWirth id, EdgeWirth next)
 {
     Id   = id;
     Next = next;
 }