Find Mapping Node in a Graph Given two large directed graphs (may have loops and lonely nodes) A and B. They are structurally similar.

If we give a node in Graph A, how to find the corresponding one in Graph B?

Finally, we need to find all the node mappings.

Of course, there can be more than one possible mapping. We need to find the similarity (ranking) percentage.

How to design such an algorithm?

The graphs are Control-flow Graphs (Call Graph) extracted from program binaries. However, due to compiler difference (optimization, inline, etc.), the graphs can be a little different.

UPDATE:

To be more clear, as shown in the figure below, we also need to find the matching like B and B',B1' ("->" means a node match):

A -> A'

B -> (B' , B1')

C -> C'

D -> D'

E -> E'

F -> F'

As this is not a sub-graph matching, I cannot find good library APIs or algorithms.
You want to solve the problem of graph isomorphism (GI). GI is not known to be in P or NP-complete; that is, we do not know any efficient algorithms.

Many algorithms have been proposed for GI. None applies to all graphs and is always fast, but you may be able to find one that is sufficiently fast in your application.

In 2015, Babai proposed a quasi-polynomial algorithm for GI [1]. As far as I know, peer-reviewed is not yet completed; I also do not know if it is practically feasible. If correct, it is the most "efficient" algorithm known in terms of Landau-style complexity.




Graph Isomorphism in Quasipolynomial Time by L. Babai (2015) [retraction note]