MATLAB: How to convert a graph to adjacency matrix

graph

Hi. I've created a graph G in MATLAB. But when I type A = adjacency(G), I get this error:
Unable to use a value of type 'graph' as an index.

Best Answer

You've created a variable named adjacency that is taking precedence over the adjacency method for graph objects. Rename the variable.