How to use the pydot.Graph.to_string 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 vincenthEE / DotEditor / pydot.py View on Github external
elif isinstance(src, (int, long)):
            edge = [ str(src) ]
        else:
            edge = [ src ]
        
        if	(self.get_parent_graph() and
            self.get_parent_graph().get_top_graph_type() and
            self.get_parent_graph().get_top_graph_type() == 'digraph' ):

            edge.append( '->' )
            
        else:
            edge.append( '--' )
            
        if isinstance(dst, frozendict):
            edge.append( Subgraph(obj_dict=dst).to_string() )
        elif isinstance(dst, (int, long)):
            edge.append( str(dst) )
        else:
            edge.append( dst )


        edge_attr = list()
        
        for attr, value in self.obj_dict['attributes'].iteritems():
        
            if value is not None:
                edge_attr.append( '%s=%s' % (attr, quote_if_necessary(value) ) )
            else:
                edge_attr.append( attr )

        ### Modified to auto-wrap of each attribute line. 2015-05 by Vincent.H
github pydot / pydot / pydot.py View on Github external
elif isinstance(src, int):
            edge = [ str(src) ]
        else:
            edge = [ src ]

        if	(self.get_parent_graph() and
            self.get_parent_graph().get_top_graph_type() and
            self.get_parent_graph().get_top_graph_type() == 'digraph' ):

            edge.append( '->' )

        else:
            edge.append( '--' )

        if isinstance(dst, frozendict):
            edge.append( Subgraph(obj_dict=dst).to_string() )
        elif isinstance(dst, int):
            edge.append( str(dst) )
        else:
            edge.append( dst )


        edge_attr = list()

        for attr in sorted(self.obj_dict['attributes']):
            value = self.obj_dict['attributes'][attr]
            if value == '':
                value = '""'
            if value is not None:
                edge_attr.append(
                    '%s=%s' % (attr, quote_if_necessary(value) ) )
            else:
github pydot / pydot / pydot.py View on Github external
def to_string(self):
        """Return string representation of edge in DOT language."""

        src = self.parse_node_ref( self.get_source() )
        dst = self.parse_node_ref( self.get_destination() )

        if isinstance(src, frozendict):
            edge = [ Subgraph(obj_dict=src).to_string() ]
        elif isinstance(src, int):
            edge = [ str(src) ]
        else:
            edge = [ src ]

        if	(self.get_parent_graph() and
            self.get_parent_graph().get_top_graph_type() and
            self.get_parent_graph().get_top_graph_type() == 'digraph' ):

            edge.append( '->' )

        else:
            edge.append( '--' )

        if isinstance(dst, frozendict):
            edge.append( Subgraph(obj_dict=dst).to_string() )
github kevinw / gitviz / pydot.py View on Github external
elif isinstance(src, (int, long)):
            edge = [ str(src) ]
        else:
            edge = [ src ]
        
        if	(self.get_parent_graph() and
            self.get_parent_graph().get_top_graph_type() and
            self.get_parent_graph().get_top_graph_type() == 'digraph' ):

            edge.append( '->' )
            
        else:
            edge.append( '--' )
            
        if isinstance(dst, frozendict):
            edge.append( Subgraph(obj_dict=dst).to_string() )
        elif isinstance(dst, (int, long)):
            edge.append( str(dst) )
        else:
            edge.append( dst )


        edge_attr = list()
        
        for attr, value in self.obj_dict['attributes'].iteritems():
        
            if value is not None:
                edge_attr.append( '%s=%s' % (attr, quote_if_necessary(value) ) )
            else:
                edge_attr.append( attr )

        edge_attr = ', '.join(edge_attr)
github vincenthEE / DotEditor / pydot.py View on Github external
def to_string(self):
        """Returns a string representation of the edge in dot language.
        """

        src = self.parse_node_ref( self.get_source() )
        dst = self.parse_node_ref( self.get_destination() )
        
        if isinstance(src, frozendict):
            edge = [ Subgraph(obj_dict=src).to_string() ]
        elif isinstance(src, (int, long)):
            edge = [ str(src) ]
        else:
            edge = [ src ]
        
        if	(self.get_parent_graph() and
            self.get_parent_graph().get_top_graph_type() and
            self.get_parent_graph().get_top_graph_type() == 'digraph' ):

            edge.append( '->' )
            
        else:
            edge.append( '--' )
            
        if isinstance(dst, frozendict):
            edge.append( Subgraph(obj_dict=dst).to_string() )
github kevinw / gitviz / pydot.py View on Github external
def to_string(self):
        """Returns a string representation of the edge in dot language.
        """

        src = self.parse_node_ref( self.get_source() )
        dst = self.parse_node_ref( self.get_destination() )
        
        if isinstance(src, frozendict):
            edge = [ Subgraph(obj_dict=src).to_string() ]
        elif isinstance(src, (int, long)):
            edge = [ str(src) ]
        else:
            edge = [ src ]
        
        if	(self.get_parent_graph() and
            self.get_parent_graph().get_top_graph_type() and
            self.get_parent_graph().get_top_graph_type() == 'digraph' ):

            edge.append( '->' )
            
        else:
            edge.append( '--' )
            
        if isinstance(dst, frozendict):
            edge.append( Subgraph(obj_dict=dst).to_string() )