VF2 アルゴリズムの実装に問題があります。多くの場合、すべてが完全に機能しているように見えますが、解決できない問題があります。
以下の例では、アルゴリズムは機能しません。この例では、2 つの同一のグラフを比較しています (下の画像を参照)。開始頂点は 0 です。s0 内で計算されるセット P は、頂点のすべてのペアのパワーセットを格納します。
以下は、実装のベースとなった VF2 に関する出版物に含まれている疑似コードです。
/* の右側のコメントは、コードの理解方法を説明しています。
以下で説明するように、 P() セットの作成が有効かどうかはわかりません。ペアのべき集合は、ペアの最初の値、次に 2 番目の値によって、辞書式順序で反復されます。
PROCEDURE Match(s)
INPUT: an intermediate state s; the initial state s0 has M(s0)=empty
OUTPUT: the mappings between the two graphs
IF M(s) covers all the nodes of G2 THEN
OUTPUT M(s)
ELSE
Compute the set P(s) of the pairs candidate for inclusion in M(s)
/*by powerset of all succesors from already matched M(s) if not empty or
/*predestors to already matched M(s) if not empty
/*or all possible not included vertices in M(s)
FOREACH (n, m)∈ P(s)
IF F(s, n, m) THEN
Compute the state s ́ obtained by adding (n, m) to M(s)
/*add n to M1(s), exclude from T1(s)
/*add m to M2(s), exclude from T2(s)
/*M1(s) is now M1(s'), other structures belong to s' too
CALL Match(s′)
END IF
END FOREACH
Restore data structures
/*Return all structures as from before foreach
END IF
END PROCEDURE
アルゴリズムが s4 に進むと、関数から戻るときに、適切な頂点の一致に関する情報が失われます。グラフが同型であっても、サブグラフ同型 ({(0,0),(1,1),(2,2),(5,3),(6,4)}) を検索することになります。
ここで何が間違っていますか?