How to use the pydot.pydot.Node function in pydot

To help you get started, we’ve selected a few pydot 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 markflorisson / minivect / graphviz.py View on Github external
def visit_FunctionNode(self, node):
        "Create a graphviz graph"
        self.graph = pydot.Dot(self.name, graph_type='digraph')

        pydot_function = self.create_node(node)
        pydot_body = self.visit(node.body)

        # Create artificial arguments for brevity
        pydot_args = pydot.Node("Arguments (omitted)")
        self.add_node(pydot_args)

        self.add_edge(pydot_function, pydot_body)
        self.add_edge(pydot_function, pydot_args)

        return self.graph
github markflorisson / minivect / pydot / pydot.py View on Github external
def get_node(self, name):
        """Retrieve a node from the graph.

        Given a node's name the corresponding Node
        instance will be returned.

        If one or more nodes exist with that name a list of
        Node instances is returned.
        An empty list is returned otherwise.
        """

        match = list()

        if self.obj_dict['nodes'].has_key(name):

            match.extend( [ Node( obj_dict = obj_dict ) for obj_dict in self.obj_dict['nodes'][name] ])

        return match
github markflorisson / minivect / graphviz.py View on Github external
def create_node(self, node):
        "Create a graphviz node from the miniast node"
        label = '"%s"' % self.format_node(node, want_type_info=False)
        self.counter += 1
        pydot_node = pydot.Node(str(self.counter), label=label)
        self.add_node(pydot_node)
        return pydot_node
github markflorisson / minivect / pydot / pydot.py View on Github external
for e in self.obj_dict['nodes'].itervalues():
            node_obj_dicts.extend(e)

        sgraph_obj_dicts = list()
        for sg in self.obj_dict['subgraphs'].itervalues():
            sgraph_obj_dicts.extend(sg)


        obj_list = [ (obj['sequence'], obj) for obj in (edge_obj_dicts + node_obj_dicts + sgraph_obj_dicts) ]
        obj_list.sort()

        for idx, obj in obj_list:

            if obj['type'] == 'node':

                node = Node(obj_dict=obj)

                if self.obj_dict.get('suppress_disconnected', False):

                    if (node.get_name() not in edge_src_set and
                        node.get_name() not in edge_dst_set):

                        continue

                graph.append( node.to_string()+'\n' )

            elif obj['type'] == 'edge':

                edge = Edge(obj_dict=obj)

                if self.obj_dict.get('simplify', False) and edge in edges_done:
                    continue
github markflorisson / minivect / pydot / pydot.py View on Github external
def set_node_defaults(self, **attrs):

        self.add_node( Node('node', **attrs) )
github markflorisson / minivect / pydot / pydot.py View on Github external
def set_graph_defaults(self, **attrs):

        self.add_node( Node('graph', **attrs) )