Find a shortest path in a directed graph that can visit each vertex at least once. Not TSP (no visit restriction and no cycle requirement)


  • 0
    K

    Find a shortest path in a directed graph that can visit each vertex at least once. Not TSP (no visit restriction and no cycle requirement)


  • 0
    J

    Simply do DFS.
    The path length will always be N, where N is the number of nodes in the graph.
    If DFS finds disconnected graph that means there is no such path.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.