Re: Graph rendering on dlang.org

2017-07-02 Thread Mark via Digitalmars-d

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.


My experience with GraphViz is that it's okay for simple, small 
diagrams but when I want to make something more complex it can be 
incredibly frustrating to make the digram look the way you want.


I didn't try Mermaid or any other visualization tools, though.


Re: Graph rendering on dlang.org

2017-07-01 Thread Mario Kröplin via Digitalmars-d

Try http://plantuml.com/ (based on dot). Paste

@startuml
hide circle
hide empty attributes
hide empty methods

class "mutable"
class "const"
class "inout"
class "inout const"
class "immutable"
class "shared"
class "shared const"
class "inout shared const"

"mutable" -up-> "const"
"inout const" -up-> "const"
"inout" -up-> "inout const"
"immutable" -up-> "inout const"
"immutable" -up-> "inout shared const"
"inout shared" -up-> "inout shared const"
"shared" -up-> "shared const"
"inout shared const" -up-> "shared const"
@enduml

http://www.plantuml.com/plantuml/svg/bOyz2i0W38LtJn7SUuNUnMf0GMinSUZjIuTA4wJGpVV3yqjC0S6dvZEQUB-n77o2OsvfwupqTWjoh86CyTaHWIsTtPRHFjhNdNYejDUk5AX6qGiKNSEW94nsGKPciC3IZsKTBEBVQJPSGVXY-vTBBc5-DrNdOqTT8ymB


Re: Graph rendering on dlang.org

2017-07-01 Thread Cym13 via Digitalmars-d

On Saturday, 1 July 2017 at 22:09:49 UTC, Jonathan Marler wrote:
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


That does look way nicer, thanks!


Re: Graph rendering on dlang.org

2017-07-01 Thread Jonathan Marler via Digitalmars-d

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


Re: Graph rendering on dlang.org

2017-07-01 Thread Andrei Alexandrescu via Digitalmars-d

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


Re: Graph rendering on dlang.org

2017-07-01 Thread Cym13 via Digitalmars-d

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.


Re: Graph rendering on dlang.org

2017-07-01 Thread Jonathan Marler via Digitalmars-d
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



Re: Graph rendering on dlang.org

2017-07-01 Thread Patrick Schluter via Digitalmars-d

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.


Re: Graph rendering on dlang.org

2017-06-30 Thread Brian Schott via Digitalmars-d
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";
   ...
}




Re: Graph rendering on dlang.org

2017-06-30 Thread H. S. Teoh via Digitalmars-d
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.


Re: Graph rendering on dlang.org

2017-06-30 Thread Andrei Alexandrescu via Digitalmars-d

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


Re: Graph rendering on dlang.org

2017-06-30 Thread Brian Schott via Digitalmars-d
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