My question is simple. I'm using networkx to build graphs from protein structures. I'm using subgraph_is_isomorphic() function but I need to allow only some amino acids to be considered equal. For example, LEU should be considered equal to ILE but not to TRP. How can I define a custom node_match function to do this?
In the following code, I need a node_match function that if used, G1 and G2 become isomorphic but not otherwise.
G1 = nx.Graph()
G1.add_node(1, label = 'ARG')
G1.add_node(2, label = 'LEU')
G1.add_edge(1, 2)
G2 = nx.Graph()
G2.add_node(1, label = 'ARG')
G2.add_node(2, label = 'ILE')
G2.add_edge(1, 2)