def add_to_graph(self, nodes, edges, nesting):
if (len(nodes) + len(self.added)) > self.max_nodes:<EOL><INDENT>if nesting < <NUM_LIT:2>:<EOL><INDENT>self.hopNodes = nodes<EOL>self.hopEdges = edges<EOL><DEDENT>self.truncated = nesting<EOL>return False<EOL><DEDENT>else:<EOL><INDENT>for n in nodes:<EOL><INDENT>self.dot.node(n.ident, **n.attribs)<EOL><DEDENT>for e in edges:<EOL><INDENT>if len(e) == <NUM_LIT:5>:<EOL><INDENT>self.dot.edge(e[<NUM_LIT:0>].ident, e[<NUM_LIT:1>].ident, style=e[<NUM_LIT:2>],<EOL>color=e[<NUM_LIT:3>], label=e[<NUM_LIT:4>])<EOL><DEDENT>else:<EOL><INDENT>self.dot.edge(e[<NUM_LIT:0>].ident, e[<NUM_LIT:1>].ident, style=e[<NUM_LIT:2>],<EOL>color=e[<NUM_LIT:3>])<EOL><DEDENT><DEDENT>self.added.update(nodes)<EOL>return True<EOL><DEDENT>
Adds nodes and edges to the graph as long as the maximum number
of nodes is not exceeded.
All edges are expected to have a reference to an entry in nodes.
If the list of nodes is not added in the first hop due to graph
size limitations, they are stored in hopNodes.
If the graph was extended the function returns True, otherwise the
result will be False.