need to know how to generate and list all the existing paths in a five node fully meshed network

sir i have a problem..suppose we have 5 nodes (A,B,C,D,E) fully meshed network. i want to find out all the possible paths that can exist in this network..like we will have n(n-1)/2 ie 10 direct paths for eg A to B, A to C, A to D and so on ..again there will n(n-1)(N-2)/2 , two - hops paths for eg A to B to C , A to B to D and so on ..i want to generate and list all possible paths through program.. Any sort of idea to do it will be highly appreciated..Plzz help

Answers (1)

Construct all the permutations of length 5. Then to get the permutations of length 4, remove the last letter from each of those and find the unique results. Continue trimming and uniquing until there is nothing left.
Question: is the assumption that no node can be repeated in a path?

4 Comments

thanks for the reply..but sir this dont solves my purpose...the combination once made should not be repeated in opposite direction..suppose path 1 is A-B-C then there shouldnt be any other path representing C-B-A..im working on network optimization using linear programing..to built different constraints i need all the available paths..the path which once got listed in one direction should be treated same in the opposite direction...if required i can email the full problem to u...plzz help
The constrain the permutations so that the first node is less than the second node.
Actually that's probably not sufficient.
Anyhow, you can always discard entries for which fliplr() of the entry is already in the list.
sorry to say so but i dont think it is a good option..it is taking a lot of time besides i have to manipulate each path further using loop....any idea to use some loop (if, for etc) to generate the paths will help me a lot...thanks for the reply

Sign in to comment.

Asked:

m
m
on 1 Jun 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!