See the graphviz package: http://hackage.haskell.org/package/graphviz
Cheers,
Thu
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
http://hackage.haskell.org/package/dotgen
On 22 June 2011 16:16, Vo Minh Thu <not...@gmail.com> wrote:
>
> See the graphviz package: http://hackage.haskell.org/package/graphviz
_______________________________________________
Within the next month, I should hopefully finally finish the new
version of graphviz. Various improvements include:
* Using Text rather than String (thus improving performance and
enforcing UTF-8 encoding)
* More user-friendly APIs, especially for Attributes
(Data.GraphViz.Attributes now exports a minimal sub-set of the more
common attributes; the complete list is now available in
Data.GraphViz.Attributes.Complete)
* A Dot graph representation with actual graph operations on it
* A Dot graph representation based loosely upon dotgen's monadic
interface (with Andy's blessing) but with the various Attributes being
used rather than (String, String). I think I'm going to be able to
make it such that you can define a graph using the monadic interface
that will almost look identical to actual Dot code.
* Pure haskell re-implementations of "dot -Tcanon" and tred.
* Improved documentation with examples.
I would like to stress to people considering using other bindings to
Graphviz/Dot (such as dotgen, language-dot, or their own
cobbled-together interface): be very careful about quoting, etc. I
have spent a _lot_ of time checking how to properly escape different
values and ensuring correctness under the hood (i.e. there is no need
to pre-escape your Text/String values; graphviz will do that for you
when generating the actual Dot code). This, after all, is the point
of having existing libraries rather than rolling your own each time.
As such, I would greatly appreciate knowing what it is that makes you
want to use a different library (admittedly the graphviz API isn't as
stable as the others, but that's because I keep trying to improve it,
and typically state in the Changelog exactly what has changed).
--
Ivan Lazar Miljenovic
Ivan.Mi...@gmail.com
IvanMiljenovic.wordpress.com
On 23 June 2011 02:48, Stephen Tetley <stephen...@gmail.com> wrote:
> Or Andy Gill's Dotgen - simple and stable:
>
> http://hackage.haskell.org/package/dotgenWithin the next month, I should hopefully finally finish the new
version of graphviz. Various improvements include:
As such, I would greatly appreciate knowing what it is that makes you
want to use a different library (admittedly the graphviz API isn't as
stable as the others, but that's because I keep trying to improve it,
and typically state in the Changelog exactly what has changed).
On 17 April 2015 at 03:12, Ivan Zakharyaschev <i...@altlinux.org> wrote:
> Hi,
>
> I have some feedback on the API of the graphviz library's monadic API
> (resulting form my explorations written down at
> http://mathoverflow.net/a/203099/13991 ).
>
> Le jeudi 23 juin 2011 04:38:21 UTC+4, Ivan Lazar Miljenovic a écrit :
>>
>> On 23 June 2011 02:48, Stephen Tetley <stephen...@gmail.com> wrote:
>> > Or Andy Gill's Dotgen - simple and stable:
>> >
>> > http://hackage.haskell.org/package/dotgen
>>
>> Within the next month, I should hopefully finally finish the new
>> version of graphviz. Various improvements include:
>>
>> As such, I would greatly appreciate knowing what it is that makes you
>>
>> want to use a different library (admittedly the graphviz API isn't as
>> stable as the others, but that's because I keep trying to improve it,
>> and typically state in the Changelog exactly what has changed).
>>
>>
>
> ### graphviz Haskell library and other ones
>
> An alternative to "graphviz" Haskell package mentioned in
> [haskell-cafe](https://groups.google.com/d/msg/haskell-cafe/ZfZaw2E9a18/xZ0OeHCGzVgJ)
> is [dotgen](http://hackage.haskell.org/package/dotgen).
>
> In [a
> follow-up](https://groups.google.com/d/msg/haskell-cafe/ZfZaw2E9a18/9P-dazcd0FsJ)
> to the post mentioning `dotgen`, the author of graphviz gives some
> comparison between them (and other similar Haskell libs). I assume his
> "plans" (about a monadic interface) have been implemented already:
Yup: http://hackage.haskell.org/package/graphviz-2999.17.0.2/docs/Data-GraphViz-Types-Monadic.html
>
>> Within the next month, I should hopefully finally finish the new
>> version of graphviz. Various improvements include:
>>
>> ...
>>
>> * A Dot graph representation based loosely upon **dotgen**'s monadic
>> interface (with Andy's blessing) but with the various Attributes being
>> used rather than (String, String). I think I'm going to be able to
>> make it such that you can define a graph using the monadic interface
>> that will almost look identical to actual Dot code.
>>
>> ...
>>
>> I would like to stress to people considering using other bindings to
>> Graphviz/Dot (such as **dotgen**, language-dot, or their own
>> cobbled-together interface): be very careful about quoting, etc. I
>> have spent a _lot_ of time checking how to properly escape different
>> values and ensuring correctness under the hood (i.e. there is no need
>> to pre-escape your Text/String values; graphviz will do that for you
>> when generating the actual Dot code). This, after all, is the point
>> of having existing libraries rather than rolling your own each time.
>
> Both points are related. (So, graphviz's monadic iterface is a safer
> improvement upon dotgen's one.)
>
> ### Considering dotgen vs graphviz closer
>
> But looking into the examples, I see that `dotgen` can use "Haskell
> ids" to identify created nodes, whereas in graphviz's monad (see the
> example above) one must supply extra strings as the unique ids (by
> which we refer to the nodes).
I used Strings as an example, as I was directly converting an existing
piece of Dot code; the original can be found here:
http://hackage.haskell.org/package/graphviz-2999.17.0.2/docs/Data-GraphViz-Types.html
But, you can use any type you like for the node identifiers, as long
as you make them an instance of the PrintDot class. That's where the
`n` in the `Dot n` type comes in.
>
> I like the first approach more ("Haskell ids").
I admittedly don't have any ability in graphviz to create new
identifiers for you. I could (just add a StateT to the internal
monadic stack which keeps track of the next unused node identifier)
but I think that would _reduce_ the flexibility of being able to use
your own type (it would either only work for `Dot Int`, or even if you
could apply a mapping function to use something like `GraphID`, but
that has a problem if you have a `Double` with the same value - and
hence same textual representation - as your Int).
The way I see it, graphviz is usually used for converting existing
Haskell values into Dot code and then processing with dot, neato, etc.
the Monadic interface exists so that you can still use the library for
static pre-specified graphs (I wrote the module for a specific use
case, but in practice found it not as useful as I thought it would be
as I typically don't have a need for static graphs in my Haskell
code).
My preference - and hence overall design with graphviz - is that you
would generate the graph first, and _then_ convert it to a Dot
representation en masse.
>
> Cf. graphviz with string ids:
>
> A short example of the monadic notation from [the
> documentation](http://hackage.haskell.org/package/graphviz-2999.16.0.0/docs/Data-GraphViz-Types-Monadic.html):
That version is a tad out of date, but shouldn't affect this.
>
> digraph (Str "G") $ do
>
> cluster (Int 0) $ do
> graphAttrs [style filled, color LightGray]
> nodeAttrs [style filled, color White]
> "a0" --> "a1"
> "a1" --> "a2"
> "a2" --> "a3"
> graphAttrs [textLabel "process #1"]
>
> cluster (Int 1) $ do
> nodeAttrs [style filled]
> "b0" --> "b1"
> "b1" --> "b2"
> "b2" --> "b3"
> graphAttrs [textLabel "process #2", color Blue]
>
> "start" --> "a0"
> "start" --> "b0"
> "a1" --> "b3"
> "b2" --> "a3"
> "a3" --> "end"
> "b3" --> "end"
>
> node "start" [shape MDiamond]
> node "end" [shape MSquare]
>
> Thanks for the packages, and best wishes,
> Ivan Z.
--
Ivan Lazar Miljenovic
Ivan.Mi...@gmail.com
http://IvanMiljenovic.wordpress.com
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe