Live data from Hacker News

Create diagrams with code using Graphviz

ncona.com

121–130 of 221 posts

Re: Create diagrams with code using Graphviz

#121
Graphviz has improved my development workflow.

I use dot notation, and in spacemacs I can have a buffer with the the png file that reloads on save.

When debugging distributed enterprise systems, being able to type in the workflow as you go and then share your findings is awesome.

Re: Create diagrams with code using Graphviz

#122

Can anyone recommend a resource for learning how to diagram? Notably, I don't want to free-design directional relationships that are counter intuitive to what people expect. Eg, if Service A calls Service B, does the arrow go to Service B? What about the response? I imagine there are a ton of little questions like this and I'd like to learn to write what people expect to see.

Perhaps https://plantuml.com/sequence-diagram ?

Re: Create diagrams with code using Graphviz

#123
I'm a big fan of Graphviz. My old team created a library called Loman, which we open-sourced, which uses DAGs to represent calculations. Each node represents a part of the calculation and contains a value, similar to a cell in an spreadsheet, and Loman tracks what is stale as you update inputs. Loman includes built in support for creating diagrams using Graphviz. In our quant research we have found that invaluable when revisiting old code, as it allows you to quickly see the structure and meaning of graphs with hundreds of nodes, containing thousands of lines of code.

We've found it quite useful for quant research, and in production it works nicely because you can serialize entire computation graph which gives an easy way to diagnose what failed and why in hundreds of interdependent computations. It's also useful for real-time displays, where you can bind market and UI inputs to nodes and calculated nodes back to the UI - some things you want to recalculate frequently, whereas some are slow and need to happen infrequently in the background.

[1] Github: https://github.com/janushendersonassetallocation/loman

[2] Docs: https://loman.readthedocs.io/en/latest/

[3] Examples: https://github.com/janushendersonassetallocation/loman/tree/...

Re: Create diagrams with code using Graphviz

#124

We're reluctant to be exposed to too much anger about misfeatures in 20 year old code that was basically a prototype that escaped from the lab, but go ahead, ask us anything. We've gotten a lot of help lately from Magnus Jacobsson, Matthew Fernandez and Mark Hansen on cleaning up the website and the code base, even some persistent bugs we could never find ourselves. Improvements that would benefit the community the m…

I just want to say thank you for releasing this. I have been using graphviz since 2008. It is part of an internal tool to visualize information in the financial industry. It has been a life saver.

Re: Create diagrams with code using Graphviz

#125
post #68

I use graphviz a lot; here I generate a 'call graph' of the codebase of simavr[0] as a pdf for example [1]. But I also use it for introspection for complex data structure. [0]: http://github.com/buserror/simavr [1]: https://github.com/buserror/simavr/blob/master/doc/simavr_ca...

This is excellent! Thank you for the share! I'm working on a Typescript Call Graph [0] and am leaning towards D3 for my visualization. But I hope I can generate something as pretty and useful as your link [1] [0]: https://github.com/whyboris/TypeScript-Call-Graph

Nice. This will be useful, I'm looking forward to it.

Are you aware of any similar tools for creating class diagrams from TS code?

Re: Create diagrams with code using Graphviz

#126
post #85

Earlier quoted context omitted.

That's great! Did these people really implement graph drawing algorithms as latex macros, or does it call an external program? I'm afraid to look it myself, lest I discover the truth.

Some of it is LaTeX, but the more intensive algorithms are done with embedded Lua, using LuaLaTeX. There is no external program.

Wow, that was a long time ago, very fun project to work on. But yeah, without deep knowledge of the TeX side you'd likely still struggle a bit to understand how the two sides interact, at least it was a bit of a struggle for me, maybe / hopefully it got a bit better in the meantime.

And thankfully LuaLaTex was ready enough at that time, I can't imagine how bad it would've been to do this in pure Tex ...

Re: Create diagrams with code using Graphviz

#127
post #105

We're reluctant to be exposed to too much anger about misfeatures in 20 year old code that was basically a prototype that escaped from the lab, but go ahead, ask us anything. We've gotten a lot of help lately from Magnus Jacobsson, Matthew Fernandez and Mark Hansen on cleaning up the website and the code base, even some persistent bugs we could never find ourselves. Improvements that would benefit the community the m…

Sincerely, I think graphviz is great the way it is. I wouldn't change the graph language and most of the suggested changes would be "nice to have". Thanks for your hard work on it!

Agreed 100%. I don't care if graphviz looks a bit dated -- it's straightforward and easy to generate. (I wouldn't say "no" to having more layout algorithms, though!)

My favourite personal use of Graphviz: A few years ago I inherited a large, legacy codebase that was very hard to understand -- full of global state modified from dozens of functions, obscure function names, etc. I used a C parser (forget which one) to convert the code to a set of ASTs, and then hacked up a Web-based, interactive graph generator, using Graphviz to create the interactive SVGs. The "app" let you click on a function (node) and zoom in to examine its callers, callees, global accesses, global mutations, etc., with a "radius" parameter to decide how much of the large graph you wanted to see. Every node was clickable, and would ask the Web app to generate a new graph centered on that node.

It was an awful, throwaway hack, and was only about 90% accurate due to parsing/preprocessor challenges. (At times I resorted to annotating the code with magic comments to facilitate graph generation -- not a sustainable approach.) But a day spent hacking with Graphviz dramatically improved my learning rate, and it was also useful in helping describe the code to others.

Re: Create diagrams with code using Graphviz

#128
I run a web service "QuickChart" that renders Graphviz charts to PNG/SVG so you can easily bring graphviz diagrams into a web app or spreadsheet. Some Graphviz fans may find it useful (it's intended as a replacement for the old Google Image Charts graphviz renderer).

   https://quickchart.io/chart?cht=gv&chl=
e.g.

   https://quickchart.io/chart?cht=gv&chl=digraph%20MyGraph%20%7Bbegin%20-%3E%20end%7D
The service is open source: https://github.com/typpo/quickchart

Re: Create diagrams with code using Graphviz

#130

We're reluctant to be exposed to too much anger about misfeatures in 20 year old code that was basically a prototype that escaped from the lab, but go ahead, ask us anything. We've gotten a lot of help lately from Magnus Jacobsson, Matthew Fernandez and Mark Hansen on cleaning up the website and the code base, even some persistent bugs we could never find ourselves. Improvements that would benefit the community the m…

Been using graphviz on and off for ~20^H^H15 years (seems like 20) and it was my introduction to graph theory and concepts. Just wanted to thank the team for maintaining an incredibly useful and versatile tool.
Post reply on HN