0

Suppose I have network with 4 nodes and 4 edges as shown belowenter image description here

All possible paths from source node 1 to destination node 4 are

{{A,C}, {A,B,D}}

From these possible paths, I want to create a zero-one matrix, where number of rows represents the number of paths and number of columns represents the number of edges in a network. The matrix takes 1 as entry if the edge is present in the path to reach destination node, and 0 as its entry if it is not. For above network, path matrix is

[1 0 1 0; 1 1 0 1] This is because all possible paths are two and hence two rows, and there are 4 edges and hence 4 columns. I have a large complex network with 15 nodes and 107 paths to which I need to apply this technique. Please help.

Azhar
  • 23
  • 3
  • How are your paths currently stored? – beaker Sep 27 '15 at 15:13
  • @beaker.. As of now, they are stored as a list. – Azhar Sep 27 '15 at 21:04
  • I don't know what "list" means in terms of Matlab data structures. Can you provide an example? – beaker Sep 27 '15 at 21:13
  • @beaker...I found all possible paths from a source node to the destination node. For the above example, I got {{1,2,4},{1,2,3,4}} as possible paths in Woflram Mathematica. But I want to do it in Matlab representing edges and not vertices, and write a path matrix for all possible paths. – Azhar Sep 27 '15 at 22:45

0 Answers0