0

I have tried to plot a graph in MATLAB the following way as found on mathworks:

s = [1 2 2 2 3 4 4 5 6 6 7 8 8 9 9 10 11 11 11 12 13 14];
t = [2 3 8 6 4 5 6 7 7 9 10 9 11 10 12 13 12 14 15 13 14 15];
G = graph(s,t)

But it returns me

Undefined function 'graph' for input arguments of type 'double'.

Basically I want to plot this undirected graph and find its path matrix. A path matrix is a matrix where number of rows is equivalent to the number of paths from source node to demand node under consideration, and number of columns is equivalent to the number of edges This matrix is a zero-one matrix with 1 as its entry if the edge is present in the path to the demand node, and 0 as its entry if it is not. For example, there are 3 edges A, B and C in a network and the possible paths from the source node to the demand node are AB and AC. Then the path matrix is expressed as.

 1     1     0
 1     0     1

The first column represents A and first row represents first possible path. How do I plot the undirected graph and find its path matrix?

Azhar
  • 23
  • 3
  • 2
    You are using built-in function `graph`, which has just been introduced in version 2015b, and seems you don't have that newest version, so you got the error. – scmg Sep 26 '15 at 23:30
  • You can try `gplot` or `biograph` instead. – Daniel Sep 27 '15 at 00:36
  • @Daniel. This question is different because it's talking about creating a matrix out of all possible paths between source and destination. – Azhar Sep 27 '15 at 01:34

0 Answers0