in reply to Visualizing a dependency graph in a web page

What you have is a "directed acyclic graph" (DAG), ie a graph (in the mathematical sense) in which the edges connecting nodes are one-way ("directed"), and such that following the edges in the right direction never creates a loop ("acyclic"). Such graphs are well-studied, and the constraints make it easy to automate creating images of them without edges having to cross each other, etc.

See https://stackoverflow.com/questions/3522889/visualizing-a-dag for example.

  • Comment on Re: Visualizing a dependency graph in a web page

Replies are listed 'Best First'.
Re^2: Visualizing a dependency graph in a web page
by LanX (Saint) on Apr 01, 2022 at 14:17 UTC
    Thanks, just after writing it occurred to me that it's of course not just a tree.

    But I also need it to be ranked by phases, that's where the time-axis comes in.

    • the jobs without dependency run in phase 0
    • the jobs depending on phase 0 run in phase 1
    • and so on
    This "rank" requirement (or was it "grade") already includes acyclic, otherwise this wouldn't be possible. I think this is an even narrower requirement than just DAG.

    Anyway talking about it helped me sketching my own algorithm already... :)

    I searched DAG with graphviz, but couldn't see them ranked in phases and the nodes were all circles (I have practically no hands-on experience with graph-viz)

    > automate creating images of them without edges having to cross each other, etc.

    Really? I have doubts it's always possible to draw a planar graph.

    consider a 3d-cube, how do you want to draw a planar graph without crossings - here x ?

    0 / | \ / | \ A B C |\ / \ /| | x x | |/ \ / \| a b c \ | / \ | / 1

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      > automate creating images of them without edges having to cross each other, etc.

      Really? I have doubts it's always possible to draw a planar graph.

      consider a 3d-cube, how do you want to draw a planar graph without crossings - here x ?

      There are two basic cases where the graphs cannot be embedded in a 2-d representation without crossing lines:

      1. 3 nodes that are each fully connected w/ 3 other nodes
        a -> A, B, C b -> A, B, C c -> A, B, C
      2. 5 densely connected nodes
        A -> B, C, D, E B -> C, D, E C -> D, E D -> E
      All graphs that can't be embedded in a 2-d plane have those cases embedded in them.

      Your cube example actually can be embedded. You just lose the pretty perspective (or gain a new one...).

      0 / | \ / | \ / B \ / / \ \ A---a c---C \ \ / / \ 1 / \ | / \ | / b
      This is proven by Kuratowski's theorem and is discussed here.

      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

        Yes, you are right. I remember discussing K5 and K3,3 in university

        > Your cube example actually can be embedded. You just lose the pretty perspective (or gain a new one...).

        And this a good example why a good question often matters more than a good answer.

        In the context of this task I need the diagram to have a top-down semantic with Y being the time-axis.

        So 0 and 1 must be at different extremes, so flattening won't be possible with Q3 °

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

        °) FWIW I remember the notation B3, but all these pandemics in the meantime must have messed with my head :)

      > > automate creating images of them without edges having to cross each other, etc.

      > Really? I have doubts it's always possible to draw a planar graph.

      You're quite right, that was a brainfart.