SPX2 wrote: > And what you have to do after you have found path a1...an with a1 input > and an output > is to try to remember the cost of the path in a vector. > that is all i think > Depth path will assure different pathways. > If you want the fastest path you can use dijkstra/royfloyd.
I think you are not understanding my algorithm. There is no need for finding a shortest path at all. It works incrementally. It would proceed in this manner. Visit 1. Do nothing. Visit 2. See that this a node with 1 in-edge and 1 out-edge. Therefore delete edges 1-2 and 2-3. Replace with edge 1-3 having sum of weights. Restart search at 3. Visit 3. See that this a node with 1 in-edge and 1 out-edge. Therefore delete edges 1-3 and 3-6. Replace with edge 1-6 having sum of weights. Restart search at 6. Visit 6. Do nothing. DFS backtracks to 1. Visit 4. See that this a node with 1 in-edge and 1 out-edge. Therefore delete edges 1-4 and 4-5. Replace with edge 1-5 having sum of weights. Restart search at 5. Visit 5. See that this a node with 1 in-edge and 1 out-edge. Therefore delete edges 1-5 and 5-6. Replace with new edge 1-6 having sum of weights. Done. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---
