How to find the pattern subgraphs in original graph?
up vote
1
down vote
favorite
I have a graph
. One can see that the complect subgraph A<->B<->C
and E<->D<->F
(pattern
) occurs twice in the graph
. I found the motifs
and took 1st and 7th motifs from the list of igraphs.
libraty(igraph)
el <- matrix( c("A", "B",
"A", "C",
"B", "A",
"B", "C",
"C", "A",
"C", "B",
"C", "E",
"E", "D",
"E", "F",
"D", "E",
"D", "F",
"F", "E",
"F", "D"),
nc = 2, byrow = TRUE)
graph <- graph_from_edgelist(el)
pattern <- graph.isocreate(size=3, number = 15, directed=TRUE)
iso <- subgraph_isomorphisms(pattern, graph)
motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) })
V(graph)$id <- seq_len(vcount(graph))
V(graph)$color <- "white"
par(mfrow=c(1,2))
plot(graph, edge.curved=TRUE, main="Original graph")
m1 <- V(motifs[[1]])$id; m2 <- V(motifs[[7]])$id
V(graph)[m1]$color="red"; V(graph)[m2]$color="green"
plot(graph, edge.curved=TRUE, main="Highlight graph")
I have a solution by hand selection motifs[[1]]
, motifs[[7]]
.
Question.
How to find the vertex lists of the pattern subgraph (for example, complect subgraph) automatically?
r igraph sna isomorphism
add a comment |
up vote
1
down vote
favorite
I have a graph
. One can see that the complect subgraph A<->B<->C
and E<->D<->F
(pattern
) occurs twice in the graph
. I found the motifs
and took 1st and 7th motifs from the list of igraphs.
libraty(igraph)
el <- matrix( c("A", "B",
"A", "C",
"B", "A",
"B", "C",
"C", "A",
"C", "B",
"C", "E",
"E", "D",
"E", "F",
"D", "E",
"D", "F",
"F", "E",
"F", "D"),
nc = 2, byrow = TRUE)
graph <- graph_from_edgelist(el)
pattern <- graph.isocreate(size=3, number = 15, directed=TRUE)
iso <- subgraph_isomorphisms(pattern, graph)
motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) })
V(graph)$id <- seq_len(vcount(graph))
V(graph)$color <- "white"
par(mfrow=c(1,2))
plot(graph, edge.curved=TRUE, main="Original graph")
m1 <- V(motifs[[1]])$id; m2 <- V(motifs[[7]])$id
V(graph)[m1]$color="red"; V(graph)[m2]$color="green"
plot(graph, edge.curved=TRUE, main="Highlight graph")
I have a solution by hand selection motifs[[1]]
, motifs[[7]]
.
Question.
How to find the vertex lists of the pattern subgraph (for example, complect subgraph) automatically?
r igraph sna isomorphism
I removed my solution as I realised something unstable in it. In any case, it is still not entirely clear what you mean by matching or "In graph can be occurred some triads and I need to color them".
– Julius Vainora
Nov 18 at 2:23
1
If you want the equivalent of motifs, usesubgraph_isomorphisms
with the LAD method (look up how) andinduced=TRUE
.
– Szabolcs
Nov 19 at 12:37
@Szabolcs, I have tried change iso <- subgraph_isomorphisms(pattern, graph) motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) }) on the iso <- subgraph_isomorphisms(pattern, graph, methof="lad",induced=TRUE), but I have 12 lists of motifs again. ,
– Nick
Nov 19 at 16:16
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a graph
. One can see that the complect subgraph A<->B<->C
and E<->D<->F
(pattern
) occurs twice in the graph
. I found the motifs
and took 1st and 7th motifs from the list of igraphs.
libraty(igraph)
el <- matrix( c("A", "B",
"A", "C",
"B", "A",
"B", "C",
"C", "A",
"C", "B",
"C", "E",
"E", "D",
"E", "F",
"D", "E",
"D", "F",
"F", "E",
"F", "D"),
nc = 2, byrow = TRUE)
graph <- graph_from_edgelist(el)
pattern <- graph.isocreate(size=3, number = 15, directed=TRUE)
iso <- subgraph_isomorphisms(pattern, graph)
motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) })
V(graph)$id <- seq_len(vcount(graph))
V(graph)$color <- "white"
par(mfrow=c(1,2))
plot(graph, edge.curved=TRUE, main="Original graph")
m1 <- V(motifs[[1]])$id; m2 <- V(motifs[[7]])$id
V(graph)[m1]$color="red"; V(graph)[m2]$color="green"
plot(graph, edge.curved=TRUE, main="Highlight graph")
I have a solution by hand selection motifs[[1]]
, motifs[[7]]
.
Question.
How to find the vertex lists of the pattern subgraph (for example, complect subgraph) automatically?
r igraph sna isomorphism
I have a graph
. One can see that the complect subgraph A<->B<->C
and E<->D<->F
(pattern
) occurs twice in the graph
. I found the motifs
and took 1st and 7th motifs from the list of igraphs.
libraty(igraph)
el <- matrix( c("A", "B",
"A", "C",
"B", "A",
"B", "C",
"C", "A",
"C", "B",
"C", "E",
"E", "D",
"E", "F",
"D", "E",
"D", "F",
"F", "E",
"F", "D"),
nc = 2, byrow = TRUE)
graph <- graph_from_edgelist(el)
pattern <- graph.isocreate(size=3, number = 15, directed=TRUE)
iso <- subgraph_isomorphisms(pattern, graph)
motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) })
V(graph)$id <- seq_len(vcount(graph))
V(graph)$color <- "white"
par(mfrow=c(1,2))
plot(graph, edge.curved=TRUE, main="Original graph")
m1 <- V(motifs[[1]])$id; m2 <- V(motifs[[7]])$id
V(graph)[m1]$color="red"; V(graph)[m2]$color="green"
plot(graph, edge.curved=TRUE, main="Highlight graph")
I have a solution by hand selection motifs[[1]]
, motifs[[7]]
.
Question.
How to find the vertex lists of the pattern subgraph (for example, complect subgraph) automatically?
r igraph sna isomorphism
r igraph sna isomorphism
edited Nov 18 at 9:29
asked Nov 17 at 3:02
Nick
273112
273112
I removed my solution as I realised something unstable in it. In any case, it is still not entirely clear what you mean by matching or "In graph can be occurred some triads and I need to color them".
– Julius Vainora
Nov 18 at 2:23
1
If you want the equivalent of motifs, usesubgraph_isomorphisms
with the LAD method (look up how) andinduced=TRUE
.
– Szabolcs
Nov 19 at 12:37
@Szabolcs, I have tried change iso <- subgraph_isomorphisms(pattern, graph) motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) }) on the iso <- subgraph_isomorphisms(pattern, graph, methof="lad",induced=TRUE), but I have 12 lists of motifs again. ,
– Nick
Nov 19 at 16:16
add a comment |
I removed my solution as I realised something unstable in it. In any case, it is still not entirely clear what you mean by matching or "In graph can be occurred some triads and I need to color them".
– Julius Vainora
Nov 18 at 2:23
1
If you want the equivalent of motifs, usesubgraph_isomorphisms
with the LAD method (look up how) andinduced=TRUE
.
– Szabolcs
Nov 19 at 12:37
@Szabolcs, I have tried change iso <- subgraph_isomorphisms(pattern, graph) motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) }) on the iso <- subgraph_isomorphisms(pattern, graph, methof="lad",induced=TRUE), but I have 12 lists of motifs again. ,
– Nick
Nov 19 at 16:16
I removed my solution as I realised something unstable in it. In any case, it is still not entirely clear what you mean by matching or "In graph can be occurred some triads and I need to color them".
– Julius Vainora
Nov 18 at 2:23
I removed my solution as I realised something unstable in it. In any case, it is still not entirely clear what you mean by matching or "In graph can be occurred some triads and I need to color them".
– Julius Vainora
Nov 18 at 2:23
1
1
If you want the equivalent of motifs, use
subgraph_isomorphisms
with the LAD method (look up how) and induced=TRUE
.– Szabolcs
Nov 19 at 12:37
If you want the equivalent of motifs, use
subgraph_isomorphisms
with the LAD method (look up how) and induced=TRUE
.– Szabolcs
Nov 19 at 12:37
@Szabolcs, I have tried change iso <- subgraph_isomorphisms(pattern, graph) motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) }) on the iso <- subgraph_isomorphisms(pattern, graph, methof="lad",induced=TRUE), but I have 12 lists of motifs again. ,
– Nick
Nov 19 at 16:16
@Szabolcs, I have tried change iso <- subgraph_isomorphisms(pattern, graph) motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) }) on the iso <- subgraph_isomorphisms(pattern, graph, methof="lad",induced=TRUE), but I have 12 lists of motifs again. ,
– Nick
Nov 19 at 16:16
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53347818%2fhow-to-find-the-pattern-subgraphs-in-original-graph%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I removed my solution as I realised something unstable in it. In any case, it is still not entirely clear what you mean by matching or "In graph can be occurred some triads and I need to color them".
– Julius Vainora
Nov 18 at 2:23
1
If you want the equivalent of motifs, use
subgraph_isomorphisms
with the LAD method (look up how) andinduced=TRUE
.– Szabolcs
Nov 19 at 12:37
@Szabolcs, I have tried change iso <- subgraph_isomorphisms(pattern, graph) motifs <- lapply(iso, function (x) { induced_subgraph(graph, x) }) on the iso <- subgraph_isomorphisms(pattern, graph, methof="lad",induced=TRUE), but I have 12 lists of motifs again. ,
– Nick
Nov 19 at 16:16