8

I have been reading the VF2 algorithm for finding if two graphs are isomorphic but am somehow missing the big picture. Could be that I am missing the relevant background in this area but all I see is a bunch of rules that I need to use at each step, without seeing an intuitive explanation for why the steps are being carried out.

From basic Googling, it appears that this is considered one of the de facto algorithms for finding if two graphs are isomorphic but for some reason I am unable to find an explanation that is simple enough to understand at a high level. Or is this algorithm known by a different name?

In any case, is anyone aware of any running examples of how this algorithm works?

Legend
  • 113,822
  • 119
  • 272
  • 400
  • What happened to your last (related) question? Deleted? I'm also interested / working on very similar things right now. Drop me an email if you can (see my profile for address). Then I'll delete this comment. – Szabolcs Jul 19 '11 at 08:10
  • @Szabolcs: Actually, I have not fully deleted the question yet. Sorry about that. I am still thinking about a good definition for stability and was thinking about reposting it in a few hours as I got stumped when you asked me how I define stability. But, I undeleted my question for now. – Legend Jul 19 '11 at 08:13

2 Answers2

11

I am not sure that's what you're looking for, but the VF2 algorithm proceeds as below.

Let's say you have 2 graphs: V and V' and you want to match V with V'

The algorithm goes down a tree, at each step you try to match a next element of V with one of V' and you stop when you went through all the nodes in V' (when you find a leaf).

Algorithm:

  • First step : match empty V with empty graph V'.
  • Second step : try to match one node in V with one node in V'
  • ...
  • Nth step : try to match one node in V with one new node in V', if you cannot go back one step in the tree and try a new match in the previous step.. and if you cant go back again etc...
  • ...
  • END : when you find a leaf, i.e when you went through all the nodes in V' or when you went through the whole tree without finding a leaf.

Example

Here is a example, the algorithm proceeds from left to right of the tree.

"A <-> B" means Match node A of V with node B of V'

enter image description here

Hope I'm clear and that's what your looking for.

Cheong Sik Feng
  • 121
  • 1
  • 7
Ricky Bobby
  • 7,490
  • 7
  • 46
  • 63
  • +1 Yes. This is what I am looking for! Many thanks for this. Just a few more (silly) questions. When you mapped V(1) to V'(1), why did you encounter a `NO SOL`?. Let us assume this is the case, now we backtrack and mapped V(1) to V'(2) and then mapped V(3) to V'(2) and finally V(3) to V'(1)? Is that how one reads this? In that case, what is the conclusion of your diagram? We mapped V(1)-V'(2), V(3)-V'(2) and V(3)-V'(1). Why match V(3) with two nodes? Or I must be interpreting it wrong. As you have come so far in explaining, could you make it more verbose if you don't mind? – Legend Jul 19 '11 at 09:24
  • You're right .I just corrected it. I made a mistake in the name of the nodes. I should verify this again :D ... it's kind of confusing to use 1 , 2 , 3 and 1 ,2 ,3 in both graphs. I should have changed it to 1,2 ,3 and A B C . Hope this one is right. :) – Ricky Bobby Jul 19 '11 at 09:27
  • 1
    Thank you very much! I thought I was missing even the most verbose explanation! Thank you for fixing it. I accepted your answer as the solution, but if you have time, would you care to explain what the intuition behind the five rules is (R_pred, R_succ, R_new...)? Are these used to conclude the `No Sol` cases in your graph? – Legend Jul 19 '11 at 09:30
  • You're welcome. I will try to have a look at the rules when I have time. – Ricky Bobby Jul 19 '11 at 09:38
  • Great! Thank you very much once again. – Legend Jul 19 '11 at 09:40
  • Can you give me more information about the 5 rules. They are not in your paper and I'm not using the same notations. – Ricky Bobby Jul 19 '11 at 17:33
  • Oh it looks like the linked paper is a newer version of another algorithm published in a journal paper: ieeexplore.ieee.org/iel5/34/29305/01323804.pdf The paper that I linked to in my question contains a revised rule for picking the candidate set whereas the journal paper contains the five rules for the feasibility function that I was talking about. – Legend Jul 19 '11 at 18:02
  • Hi, It seems like that, that got how VF2 algorithm is working. Can you please explain the steps, I am really not getting any thing in the paper ieeexplore.ieee.org/iel5/34/29305/01323804.pdf. So i would help me then i will be really thankful to you.... – Abdul Samad Nov 18 '11 at 01:53
3

I've written a high-level overview of VF2, and also a fairly compact from-scratch Java implementation for cheminformatics.

Rich Apodaca
  • 28,316
  • 16
  • 103
  • 129