public T[] DepthFirstTraversal(UnweightedUndirectedVertex <T> startNode)
        {
            List <T> returnList = new List <T>(VertexCount);

            Stack <UnweightedUndirectedVertex <T> > stack = new Stack <UnweightedUndirectedVertex <T> >();

            stack.Push(startNode);

            while (stack.Count != 0)
            {
                UnweightedUndirectedVertex <T> currentVertex = stack.Pop();
                returnList.Add(currentVertex.Value);

                foreach (UnweightedUndirectedVertex <T> vertex in currentVertex.Edges)
                {
                    if (returnList.Contains(vertex.Value))
                    {
                        continue;
                    }

                    stack.Push(vertex);
                }
            }

            return(returnList.ToArray());
        }
        public T[] BreadthFirstTraversal(UnweightedUndirectedVertex <T> startNode)
        {
            List <T> returnList = new List <T>(VertexCount);

            Queue <UnweightedUndirectedVertex <T> > queue = new Queue <UnweightedUndirectedVertex <T> >();

            queue.Enqueue(startNode);

            while (queue.Count != 0)
            {
                UnweightedUndirectedVertex <T> currentVertex = queue.Dequeue();
                returnList.Add(currentVertex.Value);

                foreach (UnweightedUndirectedVertex <T> vertex in currentVertex.Edges)
                {
                    if (returnList.Contains(vertex.Value))
                    {
                        continue;
                    }

                    queue.Enqueue(vertex);
                }
            }

            return(returnList.ToArray());
        }
        public void AddEdge(UnweightedUndirectedVertex <T> v, UnweightedUndirectedVertex <T> w)
        {
            if (v == null || w == null)
            {
                throw new Exception("One of the parameters passed was null");
            }

            v.Edges.Add(w);
            w.Edges.Add(v);
            EdgeCount++;
        }
 public bool RemoveEdge(UnweightedUndirectedVertex <T> v, UnweightedUndirectedVertex <T> w)
 {
     //and should work, maybe want or
     return(v.Edges.Remove(w) && w.Edges.Remove(v));
 }