def _dot(self, graph, node2rule=(lambda node: node), node2style=(lambda node: 'rounded'), node2label=(lambda node: node)):
    huefactor = (2 / (3 * len(self.rules)))
    rulecolor = {rule: '{:.2f} 0.6 0.85'.format((i * huefactor)) for (i, rule) in enumerate(self.rules)}
    node_markup = '\t{}[label = "{}", color = "{}", style="{}"];'.format
    edge_markup = '\t{} -> {}'.format
    ids = {node: i for (i, node) in enumerate(graph)}
    nodes = [node_markup(ids[node], node2label(node), rulecolor[node2rule(node)], node2style(node)) for node in graph]
    edges = [edge_markup(ids[dep], ids[node]) for (node, deps) in graph.items() for dep in deps]
    return textwrap.dedent('            digraph snakemake_dag {{\n                graph[bgcolor=white, margin=0];\n                node[shape=box, style=rounded, fontname=sans,                 fontsize=10, penwidth=2];\n                edge[penwidth=2, color=grey];\n            {items}\n            }}            ').format(items='\n'.join((nodes + edges)))
def _dot(self, graph, node2rule=(lambda node: node), node2style=(lambda node: 'rounded'), node2label=(lambda node: node)):
    huefactor = (2 / (3 * len(self.rules)))
    rulecolor = {rule: '{:.2f} 0.6 0.85'.format((i * huefactor)) for (i, rule) in enumerate(self.rules)}
    node_markup = '\t{}[label = "{}", color = "{}", style="{}"];'.format
    edge_markup = '\t{} -> {}'.format
    ids = {node: i for (i, node) in enumerate(graph)}
    nodes = [node_markup(ids[node], node2label(node), rulecolor[node2rule(node)], node2style(node)) for node in graph]
    edges = [edge_markup(ids[dep], ids[node]) for (node, deps) in graph.items() for dep in deps]
    return textwrap.dedent('            digraph snakemake_dag {{\n                graph[bgcolor=white, margin=0];\n                node[shape=box, style=rounded, fontname=sans,                 fontsize=10, penwidth=2];\n                edge[penwidth=2, color=grey];\n            {items}\n            }}            ').format(items='\n'.join((nodes + edges)))