How can I get adjacency matrix from the interconnection pairs?
2 views (last 30 days)
Show older comments
Jay Vaidya on 31 Dec 2019
Commented: Jay Vaidya on 3 Jan 2020
I have the matrix (matrix.xlsx) as attached below. This matrix.xlsx has all interconnection between nodes and corresponding weights. I want to construct an adjacency matrix from this. I know this could be easy when we use the below code:
Graph = digraph(matrix(:,1),matrix(:,2),matrix(:,3));
A = adjacency(Graph,'weighted');
B = full(A);
But I always get the B matrix to be SizeX^2 x SizeY^2.
Lets say SizeX = 51 and SizeY = 51 (as in this case). Then the order of the fig c matrix must be 51x51 with the data values filled by corresponding weights. But if I use the above method I get the order of fig c matrix to be 2601x2601 (=51*51x51*51). I am unable to get the below part fixed. Please suggest me some solutions. Thanks in advance. I have attached the matrix.xlsx file below.
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!