Finding path in a graph using linked list

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Dec 2006
Posts: 14
Reputation: DynamitMsk is an unknown quantity at this point 
Solved Threads: 0
DynamitMsk DynamitMsk is offline Offline
Newbie Poster

Finding path in a graph using linked list

 
0
  #1
Dec 24th, 2006
Hi everyone,

I've been working on this for days, but just can't get it. I have a linked-list containing edges of a weighted directed graph, and my goal is to find a path from vertex A to vertex B going through exactly n nodes. Anyone has suggestions, or links with examples? Thank you!!!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: Finding path in a graph using linked list

 
0
  #2
Dec 24th, 2006
Originally Posted by DynamitMsk View Post
Hi everyone,

I've been working on this for days, but just can't get it. I have a linked-list containing edges of a weighted directed graph, and my goal is to find a path from vertex A to vertex B going through exactly n nodes. Anyone has suggestions, or links with examples? Thank you!!!
Since you have worked for days on it, you must have done some research or some coding. Let us know about it.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 14
Reputation: DynamitMsk is an unknown quantity at this point 
Solved Threads: 0
DynamitMsk DynamitMsk is offline Offline
Newbie Poster

Re: Finding path in a graph using linked list

 
0
  #3
Dec 24th, 2006
I'm thinking of using something like BFS, that would just go out and label nodes by degree of closeness to given node, but thats not too efficient, I've also tried Dijkstra approach, because my other priority is to minimize that path in terms of length, but I don't think I can use it. My current plan is to use greedy approach starting at node A and go to a node n-1 far from it, then seeing if that node is directly connected to B. If it is - good, but if not then I'd have to roll back to n-2, and try to go to B from there via another node. If that fails, roll back to n-3...etc. Should I use recursion for this approach?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC