How to use the graphviz.dot.Digraph function in graphviz

To help you get started, we’ve selected a few graphviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xflr6 / graphviz / tests / test_dot.py View on Github external
def test_label_html():
    """http://www.graphviz.org/doc/info/shapes.html#html"""
    dot = Digraph('structs', node_attr={'shape': 'plaintext'})
    dot.node('struct1', '''<
<table cellspacing="0" border="0">
  <tbody><tr>
    <td>left</td>
    <td>middle</td>
    <td>right</td>
  </tr>
</tbody></table>&gt;''')
    dot.node('struct2', '''&lt;
<table cellspacing="0" border="0">
  <tbody><tr>
    <td>one</td>
    <td>two</td>
  </tr>
</tbody></table>&gt;''')
    dot.node('struct3', '''&lt;
github xflr6 / graphviz / tests / test_dot.py View on Github external
@pytest.fixture(params=list(itertools.permutations([Graph, Digraph], 2)),
                ids=lambda c: '%s, %s' % (c[0].__name__, c[1].__name__))
def classes(request):
    return request.param
github AnyBlok / AnyBlok / anyblok / _graphviz.py View on Github external
def render(self):
        """Call graphviz to create the schema """
        self.dot = Digraph(name=self.name, format=self.format,
                           node_attr={'shape': 'record',
                                      'style': 'filled',
                                      'fillcolor': 'gray95'})
        for _, cls in self._nodes.items():
            cls.render(self.dot)

        for _, edge in self._edges.items():
            self.dot.edge(edge['from'], edge['to'],
                          _attributes=edge['attr'])
github open62541 / open62541 / tools / nodeset_compiler / backend_graphviz.py View on Github external
def generateGraphvizCode(nodeset, filename="dependencies", rootNode=None, excludeNodeIds=[]):
    if rootNode is None or not isinstance(rootNode, Node) or not rootNode in nodeset.nodes:
        root = nodeset.getRoot()
    else:
        root = rootNode

    if root is None:
        return

    g = gv.dot.Digraph(name="NodeSet Dependency", format='pdf', )

    alreadyAdded = set()
    ignoreNodes = set()
    # Ignore some nodes since almost all nodes will point to that which messes up the graph
    ignoreNodes.add(NodeId("i=68")) # PropertyType
    ignoreNodes.add(NodeId("i=63")) # BaseDataVariableType
    ignoreNodes.add(NodeId("i=61")) # FolderType
    addNodeToGraph(nodeset, root, g, alreadyAdded, isRoot=True,
                   relevantReferences=nodeset.getRelevantOrderingReferences(),
                   ignoreNodes=ignoreNodes)

    g.render(filename)
github python-bonobo / bonobo / bonobo / structs / graphs.py View on Github external
def graphviz(self):
        try:
            return self._graphviz
        except AttributeError:
            g = Digraph()
            g.attr(rankdir="LR")
            g.node("BEGIN", shape="point")
            for i in self.outputs_of(BEGIN):
                g.edge("BEGIN", str(i))
            for ix in self.topologically_sorted_indexes:
                g.node(str(ix), label=get_name(self[ix]))
                for iy in self.outputs_of(ix):
                    g.edge(str(ix), str(iy))
            self._graphviz = g
            return self._graphviz