Live data from Hacker News

Who needs Graphviz when you can build it yourself?

spidermonkey.dev

51–60 of 114 posts

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

#51
post #20
post #16

I would love to see this evolve into a more general purpose control flow graph viewer - pretty much any language implementation would find it a great debugging tool. it's probably most of the way there already.

this tool works by replacing the "general purpose" algorithm by specializing it, which made it less general purpose but simpler and more efficient ... and now there's the request to make it more general purpose. (it's a joke! and the joke is that those are two different general purpose. but still.)

I do get the joke but it's a tad misplaced here.

Language developers really do struggle with debugging our data-structures since they are often both circular and complex compared to many other applications, I wrote yet-another-UI tool for inspecting code back when I was doing my thesis work.

Maybe I should brush it off (and make it general... ), it would give you a source-code view and navigating the source-text you would be shown compiler nodes related to the lines/statements.

It was almost the only way to make sense of it since I was often generating multiple paths per statement (It was a lossy type-inference system so previous type branchings could lead to multiple subsequent code-paths through each statement and expression).

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

#52
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…

> if a Contributor Distributes

Doesn't this only apply to contributors and dev users?

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

#53

D2 "should" handle most cases OP was annoyed about. Its written in Go, so its really fast too. I never had to wait for it to finish, but that said i never produced huge diagrams that i could imagine a compiler would.

When should one use D2 vs graphviz?

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

#54
post #25
post #19

To be more accurate, the comparison is not with Graphviz, but with dot(1). Graphviz is a visualization framework and it includes many layout engines, implementing different algorithms: dot, neato, fdp, sfdp, circo, twopi, ... It would be great if this new custom algorithm were to be contributed to Graphviz.

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 can see how you got that impression and don’t fault you for it in the slightest, but that’s not accurate.

It’s not the language name for all Graphviz syntax; it’s only the syntax for renderings made with the dot engine. Each engine has its own DSL, basically.

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

#55
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…

So this basically depends on how you intend to use. All big corporations use tons of copyleft software, starting with Linux. But if your aim is to take a piece of software, modify it, and don't share your modifications, and this scenario makes you not to choose this particular project, then yes, the license is working as expected. Whether the net benefit of this is positive or not is another question.

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

#56
post #19

To be more accurate, the comparison is not with Graphviz, but with dot(1). Graphviz is a visualization framework and it includes many layout engines, implementing different algorithms: dot, neato, fdp, sfdp, circo, twopi, ... It would be great if this new custom algorithm were to be contributed to Graphviz.

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, but which other compilers likely wouldn’t have.)

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

#57
post #40
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 dabbled in this area, there are poster layout generation attempts that use gen ai to come up with an initial layout plan, and even feed the visualization back into the llm for iterative fine-tuning. I was intrigued, but couldn't make it work reliably. Perhaps I forgot to add "make it look nice" to my prompts. https://arxiv.org/abs/2412.04237v3 https://haoyuchen.com/POSTA https://github.com/microsoft/LayoutGeneratio…

Thanks for sharing. Although diagrams have a unique requirement that the boxes are inter-connected, and those connections must also look "nice".

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

#58
post #2

This is a cool example of how specializing a generic algorithm to a specific subspace can yield much better results. This is quite often the case in my experience, but we often don't bother utilizing properties that are specific to our problem space, and just apply the generic algorithm out of convenience (and because it is often good enough)

I wrote my thesis on this! Application-specific system design can get you orders of magnitude performance improvement, as well as better scalability/fault tolerance properties. I focused on graph analytics, but it's reasonable to think it applies more broadly.

Definitely true that application-specific design is often not worth the investment though. Chasing that 1000x improvement can easily cost you a year or two.

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

#60
post #54
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 can see how you got that impression and don’t fault you for it in the slightest, but that’s not accurate. It’s not the language name for all Graphviz syntax; it’s only the syntax for renderings made with the dot engine. Each engine has its own DSL, basically.

> Each engine has its own DSL, basically.

Does it? There are slightly different DSLs for directed and non-directed graphs, some features only work with some output formats, but AFAIK, everything in the DSL in independent of the layout engine.

Post reply on HN