One way is to write your own algorithm using some kind of electrostatic repulsion, as in the paper associated with you. Perhaps it is possible to make Matlab in less than 40 lines (it seems others have tried ). But sometimes it's better to use external tools than do everything in Matlab. The best tool for drawing graphs is probably Graphviz , which comes with a set of tools for drawing different style graphs. For undirected graphs, one of them is neato . I donβt know what algorithm it uses to distribute nodes, but I think it is something similar to the ones that are indicated in your article (one of the links even mentions Graphviz!).
The input for these tools is a very simple text format that is fairly easy to create with Matlab. Example (this works on Linux, you may have to change it a bit on windows):
% adjacency matrix 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]; % node labels, these must be unique nodes = {'A', 'B', 'C', 'D', 'E', 'F'}; n = length(nodes); assert(all(size(A) == n)) % generate dot file for neato fid = fopen('test.dot', 'w'); fprintf(fid, 'graph G {\n'); for i = 1:n for j = i:n if A(i, j) fprintf(fid, ' %s -- %s;\n', nodes{i}, nodes{j}); end end end fprintf(fid, '}\n'); fclose(fid); % render dot file system('neato -Tpng test.dot -o test.png')
What the test.dot file gives :
graph G { A -- A; A -- B; A -- E; B -- C; B -- E; C -- D; D -- E; D -- F; }
and finally, the image test.png (note that your adjacency matrix lists the connection of the first element to itself, which shows as a loop in node A):

As a more complex example, you can draw a bucky-ball, as in the gplot documentation:
[A, XY] = bucky; nodes = arrayfun(@(i) num2str(i), 1:size(A,1), 'uni', 0);
with the result (note that the layout is executed by neato, it does not use XY ):
