igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] subgraph in igraph


From: Gábor Csárdi
Subject: Re: [igraph] subgraph in igraph
Date: Mon, 4 May 2015 09:42:24 -0400

How is this different from just calling induced.subgraph()? (Apart from being slower for small subgraphs of large graphs.)

> g <- graph.ring(10)
> V(g)$name <- LETTERS[1:10]
> get.edgelist(get_sub_graph(6:10, g), names = FALSE)
     [,1] [,2]
[1,]    1    2
[2,]    2    3
[3,]    3    4
[4,]    4    5
> get.edgelist(induced.subgraph(g, 6:10), names = FALSE)
     [,1] [,2]
[1,]    1    2
[2,]    2    3
[3,]    3    4
[4,]    4    5

G.

On Sun, May 3, 2015 at 5:47 PM, Peidong Chen <address@hidden> wrote:
I think it is better to define functions by our own.

get_sub_graph <- function(subGraphNodes,g)
{
  nonSubGraphNodes <- which(!((1:vcount(g)) %in% subGraphNodes))
  subGraph <- delete.vertices(g , nonSubGraphNodes)
  subGraph
}

2015-05-03 14:24 GMT-07:00 Fatemeh a <address@hidden>:


thanks for your reply.
 this question raised because as you mention  "induced.subgraph"actually dose that , but I checked it  when we keep delete.vertices = FALSE and with one small example it dosen't change that, but i can't be sure and generalized it, so what about when we keep the vertices  ?

On Mon, May 4, 2015 at 1:39 AM, Peidong Chen <address@hidden> wrote:
I think it changes nodes indices, because like "induced.subgraph" function creates a totally new indices different from the original graph

2015-05-03 14:07 GMT-07:00 Fatemeh a <address@hidden>:
Hi all,

I have a question regards subgraph, dose supgraph.edges function changes nodes indices?  

thank you in advance,
Fatemeh

--
regards
F..A

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help




--
regards
F..A

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

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