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: 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

Due to the reasons discussed here we will be moving to python-forum.io on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
micseydel
 
Posts: 3000
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 3 guests