GraphCS131/GraphCS131/Graph.cs
/// <summary>
/// Takes in two values and finds the path to get from the start one to the end
/// </summary>
/// <param name="s">The start value</param>
/// <param name="e">The end value</param>
/// <returns>The list of all possible paths from start to the end</returns>
Takes in two values and finds the path to get from the start one to the end
Takes in two values and finds the path to get from the start one to the end
public List<List<Vertex<T>>> FindAllPaths(T s, T e)
        {
            Vertex<T> start = Search(s);
            Vertex<T> end = Search(e);
            if (end == null || start == null) { return null; }
            foreach (var vertex in vertices)
            {
                vertex.IsVisited = false;
            }
            List<List<Vertex<T>>> paths = new List<List<Vertex<T>>>();
            FindAllPaths(start, end, new List<Vertex<T>>(), paths);
            return paths;
        }
public List < List < Vertex < T > > > FindAllPaths ( T s , T e ) { Vertex < T > start = Search ( s ) ; Vertex < T > end = Search ( e ) ; if ( end == null || start == null ) { return null ; } foreach ( var vertex in vertices ) { vertex . IsVisited = false ; } List < List < Vertex < T > > > paths = new List < List < Vertex < T > > > ( ) ; FindAllPaths ( start , end , new List < Vertex < T > > ( ) , paths ) ; return paths ; }
Takes in two values and finds the path to get from the start one to the end
Takes in two values and finds the path to get from the start one to the end
The list of all possible paths from start to the end
The list of all possible paths from start to the end
s
T
The start value
The start value
e
T
The end value
The end value