Exemplo n.º 1
0
        public void pathsFrom(char start, char end)
        {
            int       root        = _graph.GetNodeIndex(start);
            int       destination = _graph.GetNodeIndex(end);
            VertexQue route       = new VertexQue();

            BFSTraversal(root, route, destination);

            Console.Write($" There are {route.Count()} trips from {start} to {end} with max 3 stops");
        }
Exemplo n.º 2
0
        public void pathsWithMaxStops(char start, char end, int max_hops)
        {
            // graph index of start and end nodes
            int root        = _graph.GetNodeIndex(start);
            int destination = _graph.GetNodeIndex(end);

            VertexQue trips = new VertexQue();

            DFSMax(root, trips, destination);

            Console.WriteLine($"There are {trips.Count()} trips from {start} to {end} with exact 4 stops. ");
        }