I want to create a plot showing connections between nodes from an adjacency matrix like the one below.
gplot seems like the best tool for this. However, in order to use it, I need to pass the coordinate of each node. The problem is that I don't know where the coordinates should be, I was hoping the function would be capable of figuring out a good layout for me.
For example here's my output using the following arbitrary coordinates:
A = [1 1 0 0 1 0;
1 0 1 0 1 0;
0 1 0 1 0 0;
0 0 1 0 1 1;
1 1 0 1 0 0;
0 0 0 1 0 0];
crd = [0 1;
1 1;
2 1;
0 2;
1 2;
2 2];
gplot (A, crd, "o-");
Which is hard to read, but if I play around with the coordinates a bit and change them to the following it becomes much more readable.
crd = [0.5 0;
0 1;
0 2;
1 2;
1 1;
1.5 2.5];
I don't expect perfectly optimized coordinates or anything, but how can I tell MATLAB to automatically figure out a set of coordinates for me that looks okay using some sort of algorithm so I can graph something that looks like the top picture.
Thanks in advance.