943,946 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 4653
  • C RSS
Dec 24th, 2006
0

Finding path in a graph using linked list

Expand 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!!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DynamitMsk is offline Offline
14 posts
since Dec 2006
Dec 24th, 2006
0

Re: Finding path in a graph using linked list

Click to Expand / Collapse  Quote originally posted by DynamitMsk ...
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.
SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005
Dec 24th, 2006
0

Re: Finding path in a graph using linked list

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
DynamitMsk is offline Offline
14 posts
since Dec 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: setting port in linux and windows
Next Thread in C Forum Timeline: Beep the PC internal speaker





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC