[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Maximum Common Subgraph

From: Mark Galea
Subject: Re: [igraph] Maximum Common Subgraph
Date: Fri, 11 Mar 2011 15:16:07 +0000

Hi Tamas, 

Thanks a lot for your response. 

Hopefully everything will work :) Thanks for the updates example. Will wait for the build.  

Thanks a lot mate.  Much appreciated.  



On Fri, Mar 11, 2011 at 2:56 PM, Tamas Nepusz <address@hidden> wrote:

I am slightly confused what the new build will do.  Does this also update the python bindings I am already using?
Yes, beacuse the two versions (0.5 and 0.6) are binary incompatible; i.e. there were a few updates in the C layer that require the recompilation of the Python interface as well.

I have provided an example so that I'm sure that I am understanding what I should do exactly. 

This is my test case. 

from igraph import  GraphBase;
You don't need GraphBase; Graph derives from GraphBase and the latter is an internal thing anyway :)

Also, there is one other modification that you have to do; get_subisomorphisms_vf2 does not start using the vertex names "magically", it requires a numeric vector where each element specifies the "color" (or "label") of the corresponding vertex. You have to construct that mapping from names to numeric IDs yourself, and then pass the vectors mapping vertices to "colors" to get_subisomorphisms_vf2. I'll try to adapt your example:

def test(self):
    g = Graph.Formula("A-B-D")
    g2 = Graph.Formula("B-D")
    all_names = set(g.vs["name"]).union(g2.vs["name"])
    names_to_colors = dict((v, k) for k, v in enumerate(all_names))
    colors1 = [names_to_colors[name] for name in g.vs["name"]]
    colors2 = [names_to_colors[name] for name in g2.vs["name"]]
    print g.get_subisomorphisms_vf2(g2, colors1, colors2)

This one prints "[[1, 2]]" for me; I think this is the correct result as vertex 0 of the second graph maps to vertex 1 of the first one and vertex 1 of the second graph maps to vertex 2 of the first one, and there is no other mapping, right?

I'll prepare a Snow Leopard installer for you in the evening or tomorrow, when time allows.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]