Setup a positionning layout for the subgraphs

helllo people,

I have this graph with clusters this simplified
like this (because I wanted to figure out what was wrong):

digraph {
subgraph cluster_0 { A1 → A2 → A3 }
subgraph cluster_1 { B1 → B2 → B3 }
subgraph cluster_2 { C1 → C2 → C3 }
subgraph cluster_3 { D1 → D2 → D3 }
subgraph cluster_4 { E1 → E2 → E3 }
{ A1 B1 } → C1 → { D1 E1 }
}

the generated layout looks like this

AA BB
AA BB
AA CC BB
AA CC DD EE BB
CC DD EE
CC DD EE
DD EE

I’m generally happy about that but this time, I need
to publish it so I need to rearange things that way:

AA CC DD
AA CC DD
CC
BB CC EE
BB CC EE

I usually use tikz for those kind of things but I really
would like to level up my dot skills so I can keep using
graphviz. It turns out I find it hard because I don’t understand how
things comes all together. I wrote things and try to guess what should
be drawn but I fail.

for exemple: I wrote this

digraph {
rankdir=LR
rank=same
subgraph cluster_0 { A1 → A2 → A3 }
subgraph cluster_1 { B1 → B2 → B3 }
subgraph cluster_2 { C1 → C2 → C3 }
subgraph cluster_3 { D1 → D2 → D3 }
subgraph cluster_4 { E1 → E2 → E3 }
{ A1 B1 } → C1 → { D1 E1 }
}

And now some nodes are out of their subgraphs. This
really confuse me as I always saw subgraphs as “scopes”
but maybe they are not.

I started to push graphs in subgraphs to change rankdirs
but it didn’t work. also because I think subgraphs as
scopes with a local context.

I probably missed the good example or tutorial to achieve
this. Any link or help is welcome.

thanks for reading,
marc

[your code includes non-ascii characters (look at the arrows). if you use the “preformatted text” option to include code, you will prevent that]

  • Here is a good tutorial for dot https://www.graphviz.org/pdf/dotguide.pdf
  • The rank=same is causing the nodes to leave their clusters. You are misusing the attribute, but it shouldn’t do wacky things. rank=same applies to individual subgraphs, like this {rank=same A1 -> A2 -> A3}
  • To me subgraphs and clusters are very different things
    • Clusters are more like mini-graphs unto themselves
    • Subgraphs are more like sets of nodes with common attributes that may (or may not) be positioned together
  • FYI, positioning nodes where you want (as opposed to where dot wants) can be challenging, but often you can do it. Positioning clusters where you want is often ~ impossible. I usually use the gvpr program to post-process a dot output to position clusters.

I find your AA, BB, … pseudo-sketches confusing. Could you provide a pencil sketch of you want to achieve?

I knew it and read it long time ago but as far as i remember, it doesn’t
help when it comes to positionning. i’ll give it a try again. thanks for
the reminder.

  • The rank=same is causing the nodes to leave their clusters. You
    are misusing the attribute, but it shouldn’t do wacky things.
    rank=same applies to individual subgraphs, like this {rank=same A1 -> A2 -> A3}

indeed. i made some progress thanks to your informations.

  • To me subgraphs and clusters are very different things
    • Clusters are more like mini-graphs unto themselves
    • Subgraphs are more like sets of nodes with common attributes that may (or may not) be positioned together

you don’t need a subgraph for common attributes : just a block.

{ // dummies
    node [width=0,height=0,label=""]
    level1
    level1
    level1
}
  • FYI, positioning nodes where you want (as opposed to where dot
    wants) can be challenging, but often you can do it. Positioning
    clusters where you want is often ~ impossible. I usually use the
    gvpr program to post-process a dot output to position
    clusters.

i don’t even know this tool. i have to see that.

I find your AA, BB, … pseudo-sketches confusing.

that’s because the web page ruined my indentation! this is very sad the
mailing list don’t exist anymore :(.

Could you provide a pencil sketch of you want to achieve?

Using an image for such a simple thing is anoying to me. let’s
see if this weird tool know markdown first:

    AA CC DD
    AA CC DD
       CC
    BB CC EE
    BB CC EE

thanks for your help
regards
marc

Or, you can do the node layout yourself & let Graphviz (neato) do the edges, like so:

digraph z {
  // build by hand
  // use "neato -n -T..."  see http://www.graphviz.org/faq/#FaqDotWithNodeCoords
  // remember, all coordinates are in points (72/inch)
  a [pos="100,100"]
  b [pos="200,100"]
  c [pos="200,200"]
  subgraph clusterX {
    graph [bb="50,350,480,580"]
    d [pos="100,500"]
    e [pos="400,400"]
  }
  f [pos="100,200"]
  a->c
  b->f
  d->f
}

“This weird tool” being the forum? The forum is actually pretty clever and understands Markdown, complete with Graphviz syntax highlighting, inline image rendering, and niceties like turning the quotes in my prior sentence into smart quotes. Improvement suggestions are welcome, but IMHO it is already vastly superior to a mailing list.

1 Like

hello Steve,

digraph z {
  // build by hand
  // use "neato -n -T..."  see http://www.graphviz.org/faq/#FaqDotWithNodeCoords
  // remember, all coordinates are in points (72/inch)

At this point, Tikz will be more convenient so I’ll fall back to it for
this time. However, I explored every options you proposed and learned a
lot. thank you!

regards
marc

hello Matthew,

“This weird tool” being the forum?

If you see discourse as a web forum: this is probably a good tool (i
don’t know: i don’t use web fora). the thing is they claim to have a
“mailing list mode” which is probably written by people who don’t have
that much experience of mailing lists.

weird wasn’t the good term to describe what i feel but i’m sad they took
email users as second class citizen because it would be really nice to
finally have a tool to respect user choices in a fair way.

The forum is actually pretty clever and understands Markdown

that’s the point i missed in first place. indent with more spaces should
have done the job.

complete with Graphviz syntax highlighting,
inline image rendering

with no concent or possible configuration from the user. those are
both bad idea because of visual impairment and ecological low tech
users but completely normal in the web world. your vision of “superior”
is biased by your digital culture.

and niceties like turning the quotes in my prior sentence into smart quotes.

Nothing new since mailing lists but using a web app will force me
to renounce to all the power and freedom i have using my local tools:
mailing lists send emails which are just emails among others so i can
use the same workflow and tools to choose how/when i send,
recieve, annote, archive (with possible multiple taxinomies and mixed
with other contents), index, delete … i have the same interface for
everything and it’s tuned the way i want it to be (and it’s so
convenient i didn’t change that much since the last millenium. i just
added mu (GitHub - djcb/mu: maildir indexer/searcher + emacs mail client + guile bindings) and a menu made with fzf
(GitHub - junegunn/fzf: A command-line fuzzy finder) some years ago.

also: i use vim for 25 years now so i’m really demanding on what an
editor can do for me so you can imagine how painful it is to use the
the one provided by the web interface.

Improvement suggestions are welcome,
but IMHO it is already vastly superior to a mailing list.

I really appreciate your offer! thank you very much. But do you realize
it probably means to hack the code of discourse itself to make it email
friendly? if so and if you’re ready for that: it would be awesome and i
can probably share a lot of ideas with you.

regards.
marc

Fair enough. FWIW we’re also happy for you to file issues on Gitlab which you can then interact with via email. Though obviously this is suboptimal too.

By “user” I guess you mean the reader of a post here. The writer of a post has full control over their content. I may be incorrect about this, but I’m not sure how the forum degrades accessibility. Graphviz is inherently a program for producing images, so users will want to post images. On a mailing list they would attach them, on the forum they post them inline. Whether they choose accessible colors, add alt text, etc, is entirely within their control. The forum is machine readable (it’s relatively clean HTML after all), so I would assume tools like screen readers can handle it. If there’s an improvement you think could be made, please let us know.

I don’t really disagree with you. I’m a Vim user myself and was used to driving everything via my mail client. Some of my machines don’t have a GUI installed. But it seems an interactive forum is what users expect these days. I haven’t tried the mailing list mode, so it’s possible this regains the experience you’re after.

Not so much. I’m happy to tweak config settings if it will help users, but not hacking on Discourse itself. If you look at the Graphviz issue tracker, you’ll note we’re already deep underwater trying to deal with the existing workload. If you want to propose improvements to Discourse itself, their developers may be receptive.

hello Matthew,

I wrote (IMPROVE?) in the rest of the mail when there is a way to make
discourse more “civilized” (from their own words).

Not so much. I’m happy to tweak config settings if it will help users,
but not hacking on Discourse itself.

that’s why i was not optimistic even if i really enjoy your reply but
let’s take a look (maybe i underestimate the level of configuration of
this tool).

(IMPROVE?) First: this should be a new topic (based on the title) refering to the
old one (based on In-Reply-To). let’s see how discourse behave.

Fair enough. FWIW we’re also happy for you to file issues on Gitlab which you can then interact with via email. Though obviously this is suboptimal too.

(IMPROVE?) AFAIK, none of them (discoursemail and Gitlab) gives us the opportunity
to start a thread from an MUA: you need to choose between web or api
client.

By “user” I guess you mean the reader of a post here.

correct :slight_smile:

The writer of a post has full control over their content.

(IMPROVE?) well … what if i want to send plain text? it would be nice
to check if the mime type of the body is text/plain or text/markdown or
better: if a mime alternate is present.

The forum is machine readable (it’s relatively clean HTML after all), so
I would assume tools like screen readers can handle it. If there’s an
improvement you think could be made, please let us know.

as i said: i’m not reading the html part so i don’t know how it renders.

I don’t really disagree with you. I’m a Vim user myself and was used
to driving everything via my mail client. Some of my machines don’t
have a GUI installed. But it seems an interactive forum is what users
expect these days. I haven’t tried the mailing list mode, so it’s
possible this regains the experience you’re after.

I’m not against an fora at all but i know by experience it’s such a pain
to use them that i lost contact at some point so it would be if
discourse could become a bridge between the web people and the other
ones (even if it requires some tuning/discipline from client side): i
would be happy to provide any helpers for mutt or mblaze.

regards
marc

That there are, possibly, 100x more readers of ‘How to install on Windows’ than anything else here, speaks volumes.

That there are, possibly, 100x more readers of ‘How to install on Windows’ than anything else here, speaks volumes.

so this isn’t worth improving discourse?

I believe Stephen’s point was that, by the numbers, the forum has been hugely more helpful to users than the mailing list.

(I have opinions about why we keep fielding questions about how to install Graphviz, but that is a topic for another day…)

Well we discovered one concrete area where Discourse falls down. However, I suspect this choice is deliberate by the developers to deal with mail clients and/or environments that mangle email subjects and/or headers.

AFAIK you are correct.

I suspect such a thing is not possible. Same for opting to receive plain text mail.

Not sure what to say, other than sympathizing. I too have given up interacting with certain communities that required yet another username and password and yet another website for me to monitor.

Though I can’t even improve myself, or my own software, I’m not consciously standing in the way of any improvements to Discourse.

I believe Stephen’s point was that, by the numbers, the forum has been
hugely more helpful to users than the mailing list.

that’s what i said since my very first reply i wrote to you: as sad as
it is (because of the lack of diversity and freedom i already mention),
having a web forum completely makes sense nowadays.

Well we discovered one concrete area where Discourse falls down.
However, I suspect this choice is deliberate by the developers to deal
with mail clients and/or environments that mangle email subjects
and/or headers.

that’s what i said: they shouldn’t talk about a “mailing list mode”. it
doesn’t mean this is bad: it means they focus on other goals.

Not sure what to say, other than sympathizing. I too have given up
interacting with certain communities that required yet another
username and password and yet another website for me to monitor.

thanks for sympathizing. doesn’t help but feel less lonely :wink:

regards
marc

hello Stephen,

Though I can’t even improve myself, or my own software, I’m not
consciously standing in the way of any improvements to Discourse.

I wouldn’t have asked anything without Matthew inviting me to do so and
i’m completely aware of the situation you share with many free software
developpers.

I can even offer to host a mailing list if you want?

regards
marc