Imandrakit.Dot
Pretty printing in the DOT (graphviz) format.
Example (print divisors from 42
):
let open Dot in
with_out "/tmp/truc.dot"
(fun out ->
pp ~attrs_v:(fun i -> [`Label (string_of_int i)]) ~graph:divisors_graph out 42
)
type ('v, 'e) graph = 'v -> ('e * 'v) Iter.t
Directed graph with vertices of type 'v
and edges labeled with e'
type attribute = [
| `Color of string
| `Shape of string
| `Weight of int
| `Style of string
| `Label of string
| `Other of string * string
]
Dot attribute
val pp :
tbl:(module Stdlib.Hashtbl.S with type key = 'v) ->
?attrs_v:('v -> attribute list) ->
?attrs_e:('e -> attribute list) ->
?name:string ->
graph:('v, 'e) graph ->
'v Imandrakit_common.Fmt.printer
Print the graph, starting from given vertex, on the formatter.
val pp_all :
tbl:(module Stdlib.Hashtbl.S with type key = 'v) ->
?attrs_v:('v -> attribute list) ->
?attrs_e:('e -> attribute list) ->
?name:string ->
graph:('v, 'e) graph ->
'v Iter.t Imandrakit_common.Fmt.printer
Same as pp
but starting from several vertices, not just one.
val with_out : string -> (Stdlib.Format.formatter -> 'a) -> 'a
Shortcut to open a file and write to it.