========================================
Formatting the graph as a dot input file
========================================

We populate a custom working set and compute its dependency graph,
arranging for one subtree to appear more than once in the graph:

>>> anton_1 = make_dist("anton-1.egg", depends="""berta
...                                               charlie[extra]""")
>>> berta_2 = make_dist("berta-2.egg", depends="charlie")
>>> charlie_1_4 = make_dist("charlie-1.4.egg", depends="""[extra]
...                                                       dora""")
>>> dora_0_5 = make_dist("dora-0.5.egg")
>>> ws = make_working_set(anton_1, berta_2, charlie_1_4, dora_0_5)

>>> from tl.eggdeps.graph import Graph
>>> graph = Graph(working_set=ws)
>>> graph.from_working_set()
>>> sprint(graph)
{'anton': {'berta': {None: set([])}, 'charlie': {'extra': set([])}},
 'berta': {'charlie': {None: set([])}},
 'charlie': {'dora': {None: set(['extra'])}},
 'dora': {}}


Plain graphs
============

>>> from tl.eggdeps.dot import print_dot
>>> print_dot(graph, Options())
digraph {
"anton" [style="filled", fillcolor="green", label="anton"]
"berta" [style="filled", fillcolor="yellow", label="berta"]
"dora" [label="dora"]
"charlie" [style="filled", fillcolor="yellow", label="charlie"]
"anton" -> "charlie"
"anton" -> "berta"
"berta" -> "charlie"
"charlie" -> "dora" [color="lightgrey"]
}

>>> print_dot(graph, Options(version_numbers=True))
digraph {
"anton" [... label="anton 1"]
"berta" [... label="berta 2"]
"dora" [label="dora 0.5"]
"charlie" [... label="charlie 1.4"]
...
}


Clustering root nodes and their direct dependencies
===================================================

>>> print_dot(graph, Options(cluster=True))
digraph {
...
subgraph cluster_0 {
"charlie"
"berta"
"anton"
}
...
}


Including a comment in the dot file
===================================

>>> options = Options()
>>> options.comment = u"called by a doc test\nand has two lines"
>>> print_dot(graph, options)
// called by a doc test
// and has two lines
digraph {
...


.. Local Variables:
.. mode: rst
.. End:
