public int[] getPath(DirectedGraph g, int vertex)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(vertex);

            //set up the entire distance matrix with -1 except for the vertex node
            for (int i = 0; i < g.getTotalVertices(); i++)
            {
                distanceMatrix[i] = -1;
            }
            //set up current vertex with 0 because there will be no distance
            distanceMatrix[vertex] = 0;

            while (q.Count > 0)
            {
                int v = q.Dequeue();
                Console.Write(v); //this is the breadth first traversal
                ArrayList adjacent = g.Adjacent(v);
                //loop through all the adjacent nodes, if the currentVertex is still -1, then go in and do process
                for (int i = 0; i < adjacent.Count; i++)
                {
                    int currentVertex = (int)adjacent[i];
                    if (distanceMatrix[currentVertex] == -1)
                    {
                        //add one to the distanceMatrix here because it's going to be from v to the current path
                        distanceMatrix[currentVertex] = distanceMatrix[v] + 1;
                        pathMatrix[currentVertex] = v;
                        q.Enqueue(currentVertex);

                    }
                }
            }
            return distanceMatrix;
        }
 public void dfs(DirectedGraph g, int vertex)
 {
     marked[vertex] = true;
     Console.WriteLine(vertex);
     ArrayList adjacent = g.Adjacent(vertex);
     for (int i = 0; i < adjacent.Count; i++)
     {
         int currentVertex = (int) adjacent[i];
         if (!marked[currentVertex])
         {
             dfs(g, currentVertex);
         }
     }
 }