Exemple #1
0
        //public bool Remove(T value)
        //{
        //    // Locate the node in the node set
        //    var node = (GraphNode<T>)Nodes.FindByValue(value);
        //    if (node == null)
        //        return false;

        //    Nodes.Remove(node);

        //    // Remove all the edges
        //    foreach (var gn in Nodes)
        //    {
        //        int i = gn.Neighbors.IndexOf(node);
        //        if (i != -1)
        //        {
        //            gn.Neighbors.RemoveAt(i);

        //            gn.Costs.RemoveAt(i);
        //        }
        //    }

        //    return true;
        //}

        public Graph()
        {
            Nodes = new NodeListCollection <T>();
        }
Exemple #2
0
 public Graph(NodeListCollection <T> nodes)
 {
     Nodes = nodes ?? new NodeListCollection <T>();
 }
Exemple #3
0
 public GraphNode(T value, NodeListCollection <T> neighbors)
     : base(value, neighbors)
 {
     Costs = new List <int>();
 }