I am sorry, but I don't know what exactly is the problem. What's wrong with this:
library(igraph) kar <- nexus.get("karate") star3 <- graph.formula(A -- B:C:D) subiso <- graph.get.subisomorphisms.vf2(kar, star3) Then you can query the symbolic ids: V(kar)$name[ subiso[[1]]+1 ] # This is actually a bug and the +1 should not be needed Or for all isomorphic subgraphs: subiso2 <- lapply(subiso, function(x) V(kar)$name[x+1]) Gabor On Wed, Aug 1, 2012 at 11:27 PM, HIMANSHU MITTAL <hm3...@gmail.com> wrote: > Thanks, > but the problem is that igraph doesn't even give the correct id mappings. it > only gives the mapping of the structure(without labels) > > For above eg: > igraph only sees the one edge structure(of graph 2) without labels or names > and gives all possible edges in the main graph(1) to be isomorphic to the > query graph(2) > > > On Wed, Aug 1, 2012 at 9:20 PM, Gábor Csárdi <csa...@rmki.kfki.hu> wrote: >> >> Hi, >> >> igraph will give you the mappings via vertex ids. If you want to use >> symbolic vertex names, then attach a vertex attribute called 'name'. >> Then any vector of numeric vertex ids (v, from graph g) can be >> converted to vertex names via >> >> V(g)$name[v] >> >> or the more readable equivalent >> >> get.vertex.attribute(g, "name", v) >> >> Best, >> Gabor >> >> On Tue, Jul 31, 2012 at 3:12 PM, HIMANSHU MITTAL <hm3...@gmail.com> wrote: >> > Hi all, >> > I want to find all the mappings of one graph in another graph, based on >> > their vertex labels >> > Is there any way to do this in igraph based on vertex labels. >> > (as far as i know Igraph allows the subgraph isomorphism based only on >> > vertex and edge colors) >> > >> > Eg: >> > graph 1: >> > x(1) x(2) >> > x(2) y(3) >> > y(4) x(1) >> > z(5) x(2) >> > >> > graph 2: >> > x(1) y(2) >> > >> > # the brackets contain the corresponding vertex ids >> > >> > i would like my output to contain the two mappings from graph 1 >> > i.e >> > x(2) y(3) & >> > x(1) y(4) >> > >> > Regards, >> > Himanshu Mittal >> > >> > [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > R-help@r-project.org mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> > http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. >> >> >> >> -- >> Gabor Csardi <csa...@rmki.kfki.hu> MTA KFKI RMKI > > -- Gabor Csardi <csa...@rmki.kfki.hu> MTA KFKI RMKI ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.