Live data from Hacker News

Who needs Graphviz when you can build it yourself?

spidermonkey.dev

71–80 of 114 posts

Re: Who needs Graphviz when you can build it yourself?

#71
post #3

This is a concept I'm working around with Microdiagram (microdiagram.com) prototype. i.e. having a general purpose diagram/graph layout is hellishly difficult, but most of the diagrams/charts follow much simpler rules, thus it's much easier to have N languages, each for 1 type of diagram, than 1 language for N types of diagrams.

While I fully support your efforts to make better tooling, UML is the poster child for this.

I highly encourage people working in this space to revisit those lessons.

Obviously if you find a new way to work around the limitations please run with it.

But limited scope, and targeted simplifications is the only way I have found, over application by trying to describe everything almost always ends up being more harmful in my experience.

Re: Who needs Graphviz when you can build it yourself?

#73
post #9

anyone working on this space easily gets a +1! I have struggled with code to diagram tools for a while [mermaid and graphviz], and usually return to figjam when I need the readabilty and aesthetics. graph-viz is MASSIVE and a binary. mermaid requires the browser's svg rendering system to work. I just need something that builds diagrams from description easily ...

Surprised by your comment, I took a gander at graphviz; it's about a quarter of a million lines of code if you discount lib/sparse/color_palette.c and lib/edgepaint/lab_gamut.c, which are hundreds of thousands of lines of data values. This is much more than I expected.

If you want something that builds diagrams from textual descriptions, you might want to check out TikZ, which includes a subset of graphviz but also lets you draw anything you want. See https://en.wikipedia.org/wiki/PGF/TikZ. On the other hand, you won't have the rapid visual feedback you get with WYSIWYG drawing editors like FigJam.

Re: Who needs Graphviz when you can build it yourself?

#74
post #48

Earlier quoted context omitted.

Interesting. The wiki says: "The Eclipse Public License is designed to be a business-friendly free software license, and features weaker copyleft provisions than licenses such as the GNU General Public License (GPL)."

Well, it's just they think it's business-friendly. From EPL: > If a Contributor Distributes the Program in any form, then: a) the Program must also be made available as Source Code, in accordance with section 3.2 ... Except in startups that really embrace the idea of open source, no "serious" company will offer any portion of their source code under EPL license, even if that's just the modified/derived part of it. No…

There are a pretty large number of "serious" companies that distribute code under the GNU GPL, which has similar but more stringent copyleft terms. IBM, for example, which also originated the Eclipse Public License, and TI, and ARM, and Apple. Almost every microcontroller vendor uses GCC.

Re: Who needs Graphviz when you can build it yourself?

#75
post #52
post #48

Earlier quoted context omitted.

Well, it's just they think it's business-friendly. From EPL: > If a Contributor Distributes the Program in any form, then: a) the Program must also be made available as Source Code, in accordance with section 3.2 ... Except in startups that really embrace the idea of open source, no "serious" company will offer any portion of their source code under EPL license, even if that's just the modified/derived part of it. No…

> if a Contributor Distributes Doesn't this only apply to contributors and dev users?

I think it applies to anyone who distributes it; https://www.eclipse.org/legal/epl-2.0/ says:

    “Contributor” means any person or entity that Distributes the Program.

Re: Who needs Graphviz when you can build it yourself?

#76

I added one statement and it only says `timed out`. I'll stick with Graphviz, which certainly doesn't time out.

The part that is timing out is actually the JS interpreter, not the graph viewer. It’s a total hack to get SpiderMonkey running on the page at all. The full Frankenstein stack is: SpiderMonkey compiled in arm emulation mode, to a WASI 0.1 module, adapted to a WASI 0.2 component, transpiled to the web with jco, running in some random WASI shim. We do this because the JS runtime needs inline caches to be filled out bef…

It's a shame that Wasm is so hostile to runtime code generation. I've been trying to figure out how to design something that's better on that axis.

Re: Who needs Graphviz when you can build it yourself?

#77
post #27

Layout is one of those things humans do so easily and intuitively, yet you couldn't write an easy algorithm for it. I wonder if there's potential to use gen ai to achieve human like results. Anyone has any thoughts on feasibility and complexity of such an approach?

I think the hard part is more defining the different types of visually pleasing layouts that you want to support. What to align to what, what metrics to minimize, etc.

There is no single layout definition that looks good for all applications. What looks good for one type of graph data (flow charts, org charts, ASTs, family trees, etc, etc) may not look good for another.

Once you've reduced a desired type of layout to a set of layout rules, then I don't think implementing it is the bottleneck, and it seems this part could even be automated if wanted (e.g. evolve layout to best meet constraints).

Re: Who needs Graphviz when you can build it yourself?

#78
post #25

Earlier quoted context omitted.

It's a bit confusing. Dot apparently is both the language name [1] for the Graphviz syntax, and one of the layout engines [2], possibly with different capitalizations. [1] https://graphviz.org/doc/info/lang.html [2] https://graphviz.org/docs/layouts/dot/

I've used GraphViz/Dot (I call `dot` in my terminal, but the package to install is `graphviz`) for probably two decades at this point, and what is what is still not clear to me, kind of like the whole imagemagick/convert thing which is similar, at least to someone on the outside. Not sure why they can't come up with new names, use those, then when you invoke the program in the terminal, call the binary the same thing…

At least Imagemagick came to their senses and renamed their command to magick (with convert still aliased for BC).

Re: Who needs Graphviz when you can build it yourself?

#79

Earlier quoted context omitted.

I’m not sure how far you can push the generality of the iongraph algorithm. My gut is that it could be made to work somewhat well for any control flow graph with reducible control flow, but I expect there would be many complications.

To get more precise, we benefit from knowing the nesting depth of each block. This plus reducible control flow is enough to reliably find loops. We also know exactly which edges are loop backedges; it’s easiest when these are explicitly annotated but perhaps it would be possible to derive that info from other loop info. (In Ion we have a dedicated “backedge block” per loop, which makes it obvious what we should do, b…

[deleted]

Re: Who needs Graphviz when you can build it yourself?

#80

This is great! There are surprisingly few tools that actually output anything nice when it feels like such a doable problem. One small improvement they could probably make is the ability to rearrange outputs at the bottom to reduce crossings. Just from the very first example it seems flipping the 0 and 1 outputs on the bottom graph would be nicer. For anyone else interested in this general area, Steve Ruiz and Lu Wil…

Resist this temptation. It is better for the true and false branches to always appear in the same order than to permute things to avoid edge crossings.
Post reply on HN