Exemplo n.º 1
0
 public Edge(SimpleGraph <T> .Node s, SimpleGraph <T> .Node d)
 {
     this.Start = s;
     this.End   = d;
     s.Edges.Add(this);
     d.Edges.Add(this);
 }
Exemplo n.º 2
0
 public void AddEdge(T a, T b)
 {
     SimpleGraph <T> .Node s = this.nodes[a];
     SimpleGraph <T> .Node d = this.nodes[b];
     foreach (SimpleGraph <T> .Edge edge in s.Edges)
     {
         if (edge.Start.Item.Equals((object)d.Item) || edge.End.Item.Equals((object)d.Item))
         {
             return;
         }
     }
     SimpleGraph <T> .Edge edge1 = new SimpleGraph <T> .Edge(s, d);
 }
Exemplo n.º 3
0
        public T[] GetAdjacent(T item)
        {
            if (!this.nodes.ContainsKey(item))
            {
                return(new T[0]);
            }
            List <SimpleGraph <T> .Edge> list = this.nodes[item].Edges;

            T[] objArray = new T[list.Count];
            for (int index = 0; index < objArray.Length; ++index)
            {
                SimpleGraph <T> .Edge edge = list[index];
                objArray[index] = !edge.Start.Equals((object)item) ? edge.Start.Item : edge.End.Item;
            }
            return(objArray);
        }