[R] Subgraph isomorphism using vertex labels

Gábor Csárdi csardi at rmki.kfki.hu
Wed Aug 1 17:50:58 CEST 2012


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 <hm3286 at 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 at 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 <csardi at rmki.kfki.hu>     MTA KFKI RMKI



More information about the R-help mailing list