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. Related SolutionsMATLAB: I can’t create a graph from the adjacency matrix I suspect you've created a digraph object and stored it in a variable named graph, which will prevent you from calling the graph function to create a graph object. Rename that variable. MATLAB: How to obtain adjacency matrix Same basic technique as in https://www.mathworks.com/matlabcentral/answers/390250-how-to-calculate-adjacency-matrix#answer_311752 which is waiting for a response from you.A = [1 2 3 42 3 5 63 5 6 7];[r, c, s] = find(A(:,2:end));adj = full(sparse([r,s],[s,r],1)); Related QuestionConvert weighted digraph to undirectedHow to do Delaunay Triangulation and return an adjacency matrixHow to graph a connectivity/adjacency matrix
Best Answer