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.

b
/ | \
/ | \
a---+---d
\ | /
\ | /
c

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
saifjunaid
 
Posts: 8
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 irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1258
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 1 guest