Пример #1
0
 public virtual Graph.Node AddEdge(Graph.Node to, string info)
 {
     Graph.Edge e = new Graph.Edge(this, this, to, info);
     this.outs.AddItem(e);
     to.ins.AddItem(e);
     return(this);
 }
Пример #2
0
 public virtual bool SameAs(Graph.Edge rhs)
 {
     if (this.from == rhs.from && this.to == rhs.to)
     {
         return(true);
     }
     return(false);
 }
Пример #3
0
        public static IList <Graph.Edge> CombineEdges(IList <Graph.Edge> edges)
        {
            IList <Graph.Edge> ret = new AList <Graph.Edge>();

            foreach (Graph.Edge edge in edges)
            {
                bool found = false;
                for (int i = 0; i < ret.Count; i++)
                {
                    Graph.Edge current = ret[i];
                    if (edge.SameAs(current))
                    {
                        ret.Set(i, current.Combine(edge));
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    ret.AddItem(edge);
                }
            }
            return(ret);
        }
Пример #4
0
            public virtual Graph.Edge Combine(Graph.Edge rhs)
            {
                string newlabel = this.label + "," + rhs.label;

                return(new Graph.Edge(this, this.from, this.to, newlabel));
            }