question for the output of subgraph_isomorphisms

Hello everyone!

I have a question for the output of subgraph_isomorphisms, in the manual, it looks like the output is:
A list of vertex sequences, corresponding to all mappings from the first graph to the second.

This is a little confusing to me.

  1. suppose the pattern has node 1, node 2, nodes 3, in the every element of output, the first node correspond to node1 in pattern, the second node correspond to node2 in the pattern, and the third node correspond to node3 in pattern, is this correct?

  2. I’m also a little confused about the wording of ‘all the mappings’. Suppose there is some subgraph in the bigger graph, has two possible mappings to the pattern, will the element of the output list contains the two mappings?

Thanks so much and please let me know if this is not clear.

Yes, both assumptions are correct. The result will be a list where each item encodes a mapping from the vertices of the second graph to vertices of the first. If there are multiple possible mappings from the template graph to the target graph, you will get all of them in the result. Try this:

> g <- make_full_graph(5)
> g2 <- make_full_graph(3)
> subgraph_isomorphisms(g2, g)
[[1]]
+ 3/5 vertices, from 2ba05f0:
[1] 1 5 4

[[2]]
+ 3/5 vertices, from 2ba05f0:
[1] 1 5 2

[[3]]
+ 3/5 vertices, from 2ba05f0:
[1] 1 5 3

[...]

Thanks so much! This is very clear and helpful! Truly appreciate your reply!