def merge_graphs(main_graph, addition_graph):
node_mapping = {}<EOL>edge_mapping = {}<EOL>for node in addition_graph.get_all_node_objects():<EOL><INDENT>node_id = node['<STR_LIT:id>']<EOL>new_id = main_graph.new_node()<EOL>node_mapping[node_id] = new_id<EOL><DEDENT>for edge in addition_graph.get_all_edge_objects():<EOL><INDENT>edge_id = edge['<STR_LIT:id>']<EOL>old_vertex_a_id, old_vertex_b_id = edge['<STR_LIT>']<EOL>new_vertex_a_id = node_mapping[old_vertex_a_id]<EOL>new_vertex_b_id = node_mapping[old_vertex_b_id]<EOL>new_edge_id = main_graph.new_edge(new_vertex_a_id, new_vertex_b_id)<EOL>edge_mapping[edge_id] = new_edge_id<EOL><DEDENT>return node_mapping, edge_mapping<EOL>
Merges an ''addition_graph'' into the ''main_graph''.
    Returns a tuple of dictionaries, mapping old node ids and edge ids to new ids.