Search code examples
cgraphgraph-drawing

Graph drawing algorithm


I have an undirected graph on matris by vertex adjacency relations like that;

    /*    a  b  c  d
     * a -1  0  1  1
     * b  0 -1  1  1
     * c  1  1 -1  1
     * d  1  1  1 -1 
     *
     */

    int G[4][4] = {{-1, 0, 1, 1},
                   { 0,-1, 1, 1},
                   { 1, 1,-1, 1},
                   { 1, 1, 1,-1}};

I want to draw this graph on cordinate system. What's the algorithm that gives each vertex position (x,y) by any method(force-directed, spring vs)? I just ask the pseudocode, not any library or software to draw. Thanks.


Solution

  • Here is the well-decribed algorithm with as3. I solved the my problem. Thanks. http://blog.ivank.net/force-based-graph-drawing-in-as3.html