Directed Graph Layout Library for Delphi?

Does anyone know of any Delphi libraries that tackle directed acyclic graphs (DAG) and layout algorithms? In particular I’m interested in a layered layout (Sugiyama’s algorithm).

My goal here is to produce a visual representation of a target dependency graph - something like this.

[Clean]   [Build]
    |________|
         |   
     [Rebuild]   [Sign]  
         |_________|
              |
           [Deploy]

It seems like every other language out there has tons to choose from (open source to $$$$ commercial), but so far I have found nothing useful for Delphi. Of course I could attempt to translate another library to delphi… but I was hoping to avoid that if possible .

I think David Millington was asking about this on facebook previously (… maybe not for a tree shaped thing).

GraphViz is a big C++ thing … there’s this link, but it’s old and uses a COM wrapper.
https://kylecordes.com/2003/graphviz-delphi

This might be hopeful …

Otherwise if a browser panel can be used, something like d3.js ?

Thanks Paul - yeah graphviz is kinda the gold standard for opensource graph visualization. Hoping to avoid external dependencies. The com wrapper hasn’t been updated since 2004!

The graph/layout isn’t a tree - although it may appear that way, there can be multple disconnected branches or just individual nodes.

I removed the browser panel and replaced it with htmlcomponents - so d3.js isn’t an option (there are tons of libraries that use d3.js for rendering though).

1 Like

Do you have any feeling as to whether that should be consider eg an array / collection of separate graphs … or a single, connected graph with some minimal number of connections tagged ‘not visible’ (and maybe a ‘not visible’ root node) ?

Not sure - in this case the graphi is the dependency graph of targets in FinalBuilder - targets can have dependencies (other targets) which might also have dependencies etc. The current ui isn’t conducive to showing exactly what the dependency graphi is (you have to look at each target individually) - so I would like to be able to show a view for a project that shows the graph.

For most customers the graph is pretty simple but occasionally we see customers projects and working out how it all hangs together is a challenge. Being able to just look at a visual representation would be really useful.

I’m no expert in graph theory or graph layouts, I had the idea a few days ago and spent a day researching it - longer than I expected. I’ll probably have a play with some of the js or c# libraries and then try and convert the simplest one to delphi - most libraries support multiple layout algorithms - I only need one!

1 Like

Would it be useful to build it up as … or later translate it to … SVG ?

that’s an option I will explore… but I kinda want it to be interactive so I can double click on a node and get the target options dialog, or click on a vertex and press delete to remove a dependency… haven’t fully thought it through yet.

I did widen my search today - found some interesting libraries for dart and flutter to look at.

This library looks interesting

until you see the price and decide to buy a nice used car instead :moneybag: :moneybag: :moneybag: :moneybag: :money_mouth_face: - USD$10K per developer :open_mouth:

When you think … someone else developed the Quiver website for free …

In 2015 Arnaud wrote:
"In our SynProject tool, you have the ability to write DOT graphs.
It produces output like in Software Architecture Design 1.18
It can generates vectorial EMF content, and we added a SVG output for embedding into our HTML generated documentation.

The code is for non Unicode Delphi revision, but it is Open Source so you can get it and use it freely.
See http://synopse.info/fossil/wiki?name=SynProject
and GitHub - synopse/SynProject: SynProject Documentation Tool"

Lazarus has a very nice graph component used for package dependencies. I don’t know how hard it would be to get it compiling with delphi

It may be worthwhile investigating the Reingold-Tilford Algorithm.

There is a Delphi implementation at GitHub - agwidarsito/Reingold-Tilford-Algorithm: An implementation of Reingold-Tilford Algorithm in Delphi/Object Pascal. This algorithm draws a tree data structure aesthetically onto a TCanvas.

Providing Unit Tests for this implementation may be worth considering.

GPL - not going there.

Interesting, however my graph is not necessarily a tree with 1 root node (there may be multiple disconnected branches).

I did look at that, but all I found was an empty method RenderContent ?

That will not be the case for you, on my reading of the licenses of FreePascal and Lazarus.

  1. Delphi Unit Dependency Scanner. (DUDS)
    Open source - exported to Gephi.
    Our Delphi Unit Dependency Scanner (DUDS) has been updated with a couple of new features.

Gephi. (Java :frowning: )
https://gephi.org/

That just generates a graph, doesn’t visualise it. I already have the graph, that’s the easy bit :wink:

I’ve seen Geffy before -GPL or CDDL license (pretty similar to GPL) - so not even going to browse the project.

Microsoft library … MSAGL …

MIT Licence