Example #1
0
        /// <summary>
        /// builds the graph with new nodes and linked lists and weights
        /// </summary>
        public void BuildGraph()
        {
            LinkedList <Tuple <Node, int> > NodeA = new LinkedList <Tuple <Node, int> >();
            LinkedList <Tuple <Node, int> > NodeB = new LinkedList <Tuple <Node, int> >();
            LinkedList <Tuple <Node, int> > NodeC = new LinkedList <Tuple <Node, int> >();


            NodeA.AddFirst(new Tuple <Node, int>(new Node {
                Value = "cat"
            }, 10));
            NodeA.AddLast(new Tuple <Node, int>(new Node {
                Value = "pup"
            }, 5));

            NodeB.AddFirst(new Tuple <Node, int>(new Node {
                Value = "flamingo"
            }, 7));
            NodeB.AddLast(new Tuple <Node, int>(new Node {
                Value = "penguin"
            }, 3));
            NodeB.AddLast(new Tuple <Node, int>(new Node {
                Value = "owl"
            }, 5));

            NodeC.AddFirst(new Tuple <Node, int>(new Node {
                Value = "dolphin"
            }, 2));


            AdjacencyList.AddFirst(NodeA);
            Count++;
            AdjacencyList.AddLast(NodeB);
            Count++;
            AdjacencyList.AddLast(NodeC);
            Count++;
        }