Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 30, 2017 Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Currently we have a nice table at https://dlang.org/spec/const3.html#implicit_conversions documenting how implicit conversions work across qualifiers. While complete and informative, it doesn't quickly give an intuition. A DAG like the sketch at http://imgur.com/a/VuxLT would be easy to follow - all paths are possible conversions. What would be a nice tool to render this DAG online? Who'd want to work on inserting this? Ideally it would be some vector rendering. Thanks, Andrei |
June 30, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote:
> What would be a nice tool to render this DAG online? Who'd want to work on inserting this? Ideally it would be some vector rendering.
Graphviz's "dot" tool can output svg.
digraph "conversions" {
"mutable" -> "const";
"inout const" -> "const";
"inout" -> "inout const";
"immutable" -> "inout const";
"immutable" -> "inout shared const";
"inout shared" -> "inout shared const";
"shared" -> "shared const";
"inout shared const" -> "shared const";
}
dot -Tsvg conversions.dot > conversions.svg
|
June 30, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Fri, Jun 30, 2017 at 05:55:34PM -0400, Andrei Alexandrescu via Digitalmars-d wrote: > On 06/30/2017 05:52 PM, Brian Schott wrote: > > On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote: > > > What would be a nice tool to render this DAG online? Who'd want to work on inserting this? Ideally it would be some vector rendering. > > > > Graphviz's "dot" tool can output svg. > > > > > > digraph "conversions" { > > "mutable" -> "const"; > > "inout const" -> "const"; > > "inout" -> "inout const"; > > "immutable" -> "inout const"; > > "immutable" -> "inout shared const"; > > "inout shared" -> "inout shared const"; > > "shared" -> "shared const"; > > "inout shared const" -> "shared const"; > > } > > > > dot -Tsvg conversions.dot > conversions.svg > > Whoa, pretty nice: http://erdani.com/conversions.svg. How do I place the whole thing upside down? Thanks! -- Andrei Like this: digraph { edge[dir="back"]; const; const -> mutable; const -> "inout const"; const -> inout; "inout const" -> immutable; "inout shared const" -> immutable; "inout shared const" -> "inout shared"; "shared const" -> "inout shared const"; "shared const" -> shared; } T -- Freedom: (n.) Man's self-given right to be enslaved by his own depravity. |
June 30, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Schott | On 06/30/2017 05:52 PM, Brian Schott wrote: > On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote: >> What would be a nice tool to render this DAG online? Who'd want to work on inserting this? Ideally it would be some vector rendering. > > Graphviz's "dot" tool can output svg. > > > digraph "conversions" { > "mutable" -> "const"; > "inout const" -> "const"; > "inout" -> "inout const"; > "immutable" -> "inout const"; > "immutable" -> "inout shared const"; > "inout shared" -> "inout shared const"; > "shared" -> "shared const"; > "inout shared const" -> "shared const"; > } > > dot -Tsvg conversions.dot > conversions.svg Whoa, pretty nice: http://erdani.com/conversions.svg. How do I place the whole thing upside down? Thanks! -- Andrei |
June 30, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 30 June 2017 at 21:55:34 UTC, Andrei Alexandrescu wrote:
> Whoa, pretty nice: http://erdani.com/conversions.svg. How do I place the whole thing upside down? Thanks! -- Andrei
digraph "conversion" {
rankdir="BT";
...
}
|
July 01, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Schott | On Friday, 30 June 2017 at 21:52:10 UTC, Brian Schott wrote:
> On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote:
>> What would be a nice tool to render this DAG online? Who'd want to work on inserting this? Ideally it would be some vector rendering.
>
> Graphviz's "dot" tool can output svg.
>
>
> digraph "conversions" {
> "mutable" -> "const";
> "inout const" -> "const";
> "inout" -> "inout const";
> "immutable" -> "inout const";
> "immutable" -> "inout shared const";
> "inout shared" -> "inout shared const";
> "shared" -> "shared const";
> "inout shared const" -> "shared const";
> }
>
> dot -Tsvg conversions.dot > conversions.svg
That's what doxygen uses to generate call graphs, callee graphs, include hierarchies and other stuff. The dot language can also be embedded directly in the comments. It would be nice if the D document generator also used it.
|
July 01, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote: > Currently we have a nice table at https://dlang.org/spec/const3.html#implicit_conversions documenting how implicit conversions work across qualifiers. While complete and informative, it doesn't quickly give an intuition. > > A DAG like the sketch at http://imgur.com/a/VuxLT would be easy to follow - all paths are possible conversions. > > What would be a nice tool to render this DAG online? Who'd want to work on inserting this? Ideally it would be some vector rendering. > > > Thanks, > > Andrei There's also mermaid. They have a live editor here: https://knsv.github.io/mermaid/live_editor/ You can view the diagram here: https://knsv.github.io/mermaid/live_editor/#/view/Z3JhcGggQlQKCiUlIERlY2xhcmUgTm9kZXMgV2l0aCBTcGFjZXMgaW4gdGhlaXIgTmFtZQppbm91dF9jb25zdFtpbm91dCBjb25zdF0Kc2hhcmVkX2NvbnN0W3NoYXJlZCBjb25zdF0KaW5vdXRfc2hhcmVkX2NvbnN0W2lub3V0IHNoYXJlZCBjb25zdF0KaW5vdXRfc2hhcmVkW2lub3V0IHNoYXJlZF0KCiUlIExlZnQgaGFuZCBzaWRlIG9mIGdyYXBoCm11dGFibGUgLS0-IGNvbnN0Cmlub3V0X2NvbnN0IC0tPiBjb25zdAppbm91dCAtLT4gaW5vdXRfY29uc3QKaW1tdXRhYmxlIC0tPiBpbm91dF9jb25zdAoKJSUgUmlnaHQgaGFuZCBzaWRlIG9mIGdyYXBoCmltbXV0YWJsZSAtLT4gaW5vdXRfc2hhcmVkX2NvbnN0Cmlub3V0X3NoYXJlZCAtLT4gaW5vdXRfc2hhcmVkX2NvbnN0CnNoYXJlZCAtLT4gc2hhcmVkX2NvbnN0Cmlub3V0X3NoYXJlZF9jb25zdCAtLT4gc2hhcmVkX2NvbnN0 The syntax to create the given graph would be: graph BT %% Declare Nodes With Spaces in their Name inout_const[inout const] shared_const[shared const] inout_shared_const[inout shared const] inout_shared[inout shared] %% Left hand side of graph mutable --> const inout_const --> const inout --> inout_const immutable --> inout_const %% Right hand side of graph immutable --> inout_shared_const inout_shared --> inout_shared_const shared --> shared_const inout_shared_const --> shared_const |
July 01, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Marler | On Saturday, 1 July 2017 at 19:19:09 UTC, Jonathan Marler wrote:
> On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote:
>> [...]
>
> There's also mermaid. They have a live editor here: https://knsv.github.io/mermaid/live_editor/
>
> [...]
Graphviz looks nicer both as diagram and markup honnestly; the separation in two halves make it harder to read for me compared to the more direct approach of graphviz.
|
July 01, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Patrick Schluter | On 07/01/2017 03:56 AM, Patrick Schluter wrote:
> On Friday, 30 June 2017 at 21:52:10 UTC, Brian Schott wrote:
>> On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote:
>>> What would be a nice tool to render this DAG online? Who'd want to work on inserting this? Ideally it would be some vector rendering.
>>
>> Graphviz's "dot" tool can output svg.
>>
>>
>> digraph "conversions" {
>> "mutable" -> "const";
>> "inout const" -> "const";
>> "inout" -> "inout const";
>> "immutable" -> "inout const";
>> "immutable" -> "inout shared const";
>> "inout shared" -> "inout shared const";
>> "shared" -> "shared const";
>> "inout shared const" -> "shared const";
>> }
>>
>> dot -Tsvg conversions.dot > conversions.svg
>
> That's what doxygen uses to generate call graphs, callee graphs, include hierarchies and other stuff. The dot language can also be embedded directly in the comments. It would be nice if the D document generator also used it.
That's a cool idea. (Do it!) At least at a point someone generated the global import graph for phobos. It would be great to have that available permanently so we know how to improve it. -- Andrei
|
July 01, 2017 Re: Graph rendering on dlang.org | ||||
---|---|---|---|---|
| ||||
Posted in reply to Cym13 | On Saturday, 1 July 2017 at 20:53:07 UTC, Cym13 wrote:
> On Saturday, 1 July 2017 at 19:19:09 UTC, Jonathan Marler wrote:
>> On Friday, 30 June 2017 at 21:40:05 UTC, Andrei Alexandrescu wrote:
>>> [...]
>>
>> There's also mermaid. They have a live editor here: https://knsv.github.io/mermaid/live_editor/
>>
>> [...]
>
> Graphviz looks nicer both as diagram and markup honnestly; the separation in two halves make it harder to read for me compared to the more direct approach of graphviz.
I'm not an expert, but from what I've read mermaid has some nice tools that make it easy to integrate into websites such as styling via CSS and javascript libraries that convert mermaid to SVG. This allows graphics to be generated on the client side (kinda cool). Since the graphs are styled via CSS a website could make sure all their graphs are styled consistently, and the style can be changed without having to regenerate the graphic.
I've used both GraphViz and Mermaid a little, I opted to use mermaid recently because of the live editor, didn't have to download any tools and saw my results right away which was very convenient. I've also used GraphViz which was nice but had it's own quirks. I'm also not sure if GraphViz supports sequence diagrams, that might be why I found mermaid in the first place. Not sure which one is better, would be good to get an opinion from someone who was a good amount of experience with both. I'm not sure what you meant in your comment by "the separation in two halves make it harder to read"....I've rewritten the same graph so it looks more like the GraphViz version:
graph BT
mutable --> const
inout_const[inout const] --> const
inout --> inout_const
immutable --> inout_const
immutable --> inout_shared_const[inout shared const]
inout_shared[inout shared] --> inout_shared_const
shared --> shared_const[shared const]
inout_shared_const --> shared_const
|
Copyright © 1999-2021 by the D Language Foundation