find all paths in an undirected graph.

A forum for general discussion of the Python programming language.

find all paths in an undirected graph.

Postby saifjunaid » Tue Jun 11, 2013 5:32 am

hi i want the algorithm to find all possible paths from source node to destination node in an undirected graph such that a path may traverse the link only once.i was able to implemented it for a directed graph but i dont know how to implemented in undirected graph.please help me.

/ | \
/ | \
\ | /
\ | /

If the source is 'a', and the destination is 'd', the program should return:

a - d
a - b - d
a - c - d
a - b - c - d
a - c - b - d
the input should be taken from the user for nodes.Thanks in advance
Posts: 13
Joined: Sat Feb 23, 2013 10:53 am

Re: find all paths in an undirected graph.

Postby micseydel » Tue Jun 11, 2013 6:41 am

Join the #python-forum IRC channel on for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2904
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 2 guests