def _find_changed(old, new, both):
<EOL>old_edges = []<EOL>for edge in old.edges(data=True):<EOL><INDENT>if set((edge[<NUM_LIT:0>], edge[<NUM_LIT:1>])) not in both:<EOL><INDENT>continue<EOL><DEDENT>cost = (edge[<NUM_LIT:2>]['<STR_LIT>'],)<EOL>old_edges.append(set((edge[<NUM_LIT:0>], edge[<NUM_LIT:1>], cost)))<EOL><DEDENT>new_edges = []<EOL>for edge in new.edges(data=True):<EOL><INDENT>if set((edge[<NUM_LIT:0>], edge[<NUM_LIT:1>])) not in both:<EOL><INDENT>continue<EOL><DEDENT>cost = (edge[<NUM_LIT:2>]['<STR_LIT>'],)<EOL>new_edges.append(set((edge[<NUM_LIT:0>], edge[<NUM_LIT:1>], cost)))<EOL><DEDENT>changed = []<EOL>for new_edge in new_edges:<EOL><INDENT>if new_edge not in old_edges:<EOL><INDENT>new_edge = list(new_edge)<EOL>for item in new_edge:<EOL><INDENT>if isinstance(item, tuple):<EOL><INDENT>cost = {'<STR_LIT>': item[<NUM_LIT:0>]}<EOL>new_edge.remove(item)<EOL><DEDENT><DEDENT>changed.append((new_edge[<NUM_LIT:0>], new_edge[<NUM_LIT:1>], cost))<EOL><DEDENT><DEDENT>return changed<EOL>
returns links that have changed cost