Menu

Feature Request: Adding 'subgraph cluster' for libraries in the same directory

Nick Brown
2013-11-21
2014-05-26
  • Nick Brown

    Nick Brown - 2013-11-21

    It would be great if the graph that depot output contained "subgraph
    cluster_*" for each group of libraries that with the same directory as
    these often form packages and grouping them like this can really help
    with visualisation. (when run through dot, as neato does not support
    clusters.)

    I often have a directory structure like this:

    lib_a.o
    lib_b.o
    component_bob/lib_x.o
    component_bob/lib_y.o
    component_frank/lib_foo.o
    component_frank/lib_bar.o
    

    and I run this through depdot like this:

    for i in `find . -type f -iname '*.o'` ; do nm $i | depdot.pl | awk
    "{printf(\"$i|%s\n\", \$0);}" ; done | depdot > graph.dot
    dot -Tjpg graph.dot > graph.jpg
    

    Which produces output like:

    digraph lib {
    node_1 [label="./lib_a.o"]
    node_2 [label="./lib_b.o"]
    node_3 [label="./component_bob/lib_x.o"]
    node_4 [label="./component_bob/lib_y.o"]
    node_5 [label="./component_frank/lib_foo.o"]
    node_6 [label="./component_frank/lib_bar.o"]
    
    //Edges below. Example:
    node_1->node_2
    node_1->node_5
    node_3->node_6
    // etc etc
    
    }
    

    but it would nice if the output was more like:

    digraph lib {
    node_1 [label="./lib_a.o"]
    node_2 [label="./lib_b.o"]
    subgraph cluster_1 {
    label="component_bob";
    node_3 [label="./component_bob/lib_x.o"]
    node_4 [label="./component_bob/lib_y.o"]
    }
    subgraph cluster_2 {
    label="component_frank"
    node_5 [label="./component_frank/lib_foo.o"]
    node_6 [label="./component_frank/lib_bar.o"]
    }
    
    //Edges exactly the same as before.
    node_1->node_2
    node_1->node_5
    node_3->node_6
    // etc etc
    
    }
    

    The graph produced by running this through dot better helps to
    visualise both library and component dependancies.
    Would it be possible to add this to depdot?

    Cheers,
    Nick

     
    • Andrew Peter Marlow

      Hello Nick, many thanks for your feedback. I shall consider it.
      Apologies for not getting to this earlier. I don't make many updates to depdot these days so I have only just picked up your message.

       

Log in to post a comment.