def to_string(self):
graph = list()<EOL>if self.obj_dict.get('<STR_LIT:strict>', None) is not None:<EOL><INDENT>if self==self.get_parent_graph() and self.obj_dict['<STR_LIT:strict>']:<EOL><INDENT>graph.append('<STR_LIT>')<EOL><DEDENT><DEDENT>if self.obj_dict['<STR_LIT:name>'] == '<STR_LIT>':<EOL><INDENT>if '<STR_LIT>' in self.obj_dict and self.obj_dict['<STR_LIT>']:<EOL><INDENT>graph.append( '<STR_LIT>' )<EOL><DEDENT>else:<EOL><INDENT>graph.append( '<STR_LIT>' )<EOL><DEDENT><DEDENT>else:<EOL><INDENT>graph.append( '<STR_LIT>' % (self.obj_dict['<STR_LIT:type>'], self.obj_dict['<STR_LIT:name>']) )<EOL><DEDENT>for attr in self.obj_dict['<STR_LIT>'].keys():<EOL><INDENT>if self.obj_dict['<STR_LIT>'].get(attr, None) is not None:<EOL><INDENT>val = self.obj_dict['<STR_LIT>'].get(attr)<EOL>if val is not None:<EOL><INDENT>graph.append( '<STR_LIT>' % (attr, quote_if_necessary(val)) )<EOL><DEDENT>else:<EOL><INDENT>graph.append( attr )<EOL><DEDENT>graph.append( '<STR_LIT>' )<EOL><DEDENT><DEDENT>edges_done = set()<EOL>edge_obj_dicts = list()<EOL>for e in self.obj_dict['<STR_LIT>'].values():<EOL><INDENT>edge_obj_dicts.extend(e)<EOL><DEDENT>if edge_obj_dicts:<EOL><INDENT>edge_src_set, edge_dst_set = list(zip( *[obj['<STR_LIT>'] for obj in edge_obj_dicts] ))<EOL>edge_src_set, edge_dst_set = set(edge_src_set), set(edge_dst_set)<EOL><DEDENT>else:<EOL><INDENT>edge_src_set, edge_dst_set = set(), set()<EOL><DEDENT>node_obj_dicts = list()<EOL>for e in self.obj_dict['<STR_LIT>'].values():<EOL><INDENT>node_obj_dicts.extend(e)<EOL><DEDENT>sgraph_obj_dicts = list()<EOL>for sg in self.obj_dict['<STR_LIT>'].values():<EOL><INDENT>sgraph_obj_dicts.extend(sg)<EOL><DEDENT>obj_list = [ (obj['<STR_LIT>'], obj) for obj in (edge_obj_dicts + node_obj_dicts + sgraph_obj_dicts) ]<EOL>obj_list.sort()<EOL>for idx, obj in obj_list:<EOL><INDENT>if obj['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>node = Node(obj_dict=obj)<EOL>if self.obj_dict.get('<STR_LIT>', False):<EOL><INDENT>if (node.get_name() not in edge_src_set and<EOL>node.get_name() not in edge_dst_set):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>graph.append( node.to_string()+'<STR_LIT:\n>' )<EOL><DEDENT>elif obj['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>edge = Edge(obj_dict=obj)<EOL>if self.obj_dict.get('<STR_LIT>', False) and edge in edges_done:<EOL><INDENT>continue<EOL><DEDENT>graph.append( edge.to_string() + '<STR_LIT:\n>' )<EOL>edges_done.add(edge)<EOL><DEDENT>else:<EOL><INDENT>sgraph = Subgraph(obj_dict=obj)<EOL>graph.append( sgraph.to_string()+'<STR_LIT:\n>' )<EOL><DEDENT><DEDENT>graph.append( '<STR_LIT>' )<EOL>return '<STR_LIT>'.join(graph)<EOL>
Returns a string representation of the graph in dot language.

        It will return the graph and all its subelements in string from.