graphgraph-theorygraph-layout

Graph Layout algorithm Library without viewer


I'm looking for an open source graph layout algorithm library that can function the following way: The user sends a list of nodes(nodes having different sizes) and a list of edges as parameters. The function then calculates the positions of the nodes and the edges according to the graph algorithms that the library supports(should support at least non-binary tree graph layout). Finally, it returns the positions of the nodes(coordinates) for the user to process and render in their own viewer. The algorithm should be able to also update already existing graphs(insertion/deletion).

I'm using WPF to render the data and create the graph, here is what I've tried so far:

  1. Using MSAGL direct WPF graph creation forms. But it doesn't support tree graph layouts
  2. Using Graphviz DOT language, converting the graph file to .plain and using a project text trying to understand how to process the .plain file to a WPF graph. There is no much that can be found in the project on how the author manages to get info from the .plain file.
  3. Using open source projects like GraphX, NetworkViewSampleCode, QuikGraph, QuickGraph, NodeGraph to create the graph. Either they do not support tree layout, don't support dynamic insertions/deletions, or don't support different size nodes

I was expecting to find a library that could provide such functionality, but it seems to be a bit to specific. Should I start looking for tutorials on how to develop graph layout algorithms?


Solution

  • Graphviz does this if you use the -Tplain option

    $ echo 'digraph { a->b }' | dot -Tplain
    graph 1 0.75 1.5
    node a 0.375 1.25 0.75 0.5 a solid ellipse black lightgrey
    node b 0.375 0.25 0.75 0.5 b solid ellipse black lightgrey
    edge a b 4 0.375 0.99579 0.375 0.88865 0.375 0.7599 0.375 0.64045 solid black
    stop
    

    There are four types of output statements.

     graph scale width height
     node name x y width height label style shape color fillcolor
     edge tail head n x₁ y₁ .. xₙ yₙ [label xl yl] style color
     stop
    

    node The name value is the name of the node, and x and y give the node's position.

    https://graphviz.org/docs/outputs/plain/