[][src]Function gsgdt::match_graphs

pub fn match_graphs<'a>(
    d1: &'a DiffGraph<'_>,
    d2: &'a DiffGraph<'_>
) -> Vec<Match<'a>>

Matches both graphs and returns the mapping of nodes from g1 to g2.

A 'matching' (or match) is a mapping from a graph 1 node to a graph 2 node.

The list of matches returned by this function is a one to one mapping from graph 1 nodes to graph 2 nodes.

Explanation of the algorithm

  1. Find initial list of matches, Mi: n1i -> n2i
  2. If there a parent (say p) of any matched node (say x) in graph 1 is not matched
    1. L = Find the parents of the node that is matched with x (parents(Mi(x)))
    2. y = Find the node that most closely matches p in L
    3. Add y to the matches, Mi(x) = y
  3. Iterate until there are no more matches to be found

The initial matching is called Full matching. The subsequent matches are called partial matches.