igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Question about the functions induced.subgraph() and cluster


From: Gábor Csárdi
Subject: Re: [igraph] Question about the functions induced.subgraph() and clusters()
Date: Fri, 21 Mar 2014 10:17:57 -0400

Internal vertex ids change if you change the graph. E.g.

set.seed(42)
ga <- erdos.renyi.game(1000, 1500, type = "gnm", directed=TRUE)
ga
wcca <- clusters(ga, mode="weak")
for (i in 1:10) {
   largest_wcc_va <- which(wcca$membership == which.max(wcca$csize))
   ga <- induced.subgraph(ga, largest_wcc_va)
}
ga

Gabor



On Fri, Mar 21, 2014 at 10:00 AM, address@hidden <address@hidden> wrote:
 
Hi!
 
It is known to us that the maximal weakly connected component of a connected nework is itself. Just like the code below shows that the elements of Siz_wcc never change.
 
        ga <- erdos.renyi.game(1000, 1500, type = "gnm", directed=TRUE);
        Siz_wcc <- rep(0,10) 
         for(i in 1:10)
         {
             wcca <- clusters(ga, mode="weak")
             largest_wcc_va <- which(wcca$membership == which.max(wcca$csize))
             Siz_wcc[i] <- length(largest_wcc_va)     
             ga <- induced.subgraph(ga, largest_wcc_va, impl="copy_and_delete")
         }
>  Siz_wcc
[1] 936 936 936 936 936 936 936 936 936 936
 
Given two networks ga and gb, if network ga is exactly the same with network gb, then the elements in Siz_wcca and Siz_wccb are also expected to be invariant. But Siz_wcca and Siz_wccb decrease to 1 in the end. How could this happen?
 
         gb <- erdos.renyi.game(1000, 1500, type = "gnm", directed=TRUE);
         ga <- gb          
         Siz_wcca <- rep(0,10) 
         Siz_wccb <- rep(0,10) 
         for(i in 1:10)
         {
 
             wcca <- clusters(ga, mode="weak")
             largest_wcc_va <- which(wcca$membership == which.max(wcca$csize))
             Siz_wcca[i] <- length(largest_wcc_va)     
             gb <- induced.subgraph(gb, largest_wcc_va, impl="copy_and_delete")
 
             wccb <- clusters(gb, mode="weak")
             largest_wcc_vb <- which(wccb$membership == which.max(wccb$csize))
             Siz_wccb[i] <- length(largest_wcc_vb)
             ga <- induced.subgraph(ga, largest_wcc_vb, impl="copy_and_delete")
          }
> Siz_wcca
[1] 933 854 756 615 331   3   1   1   1   1
> Siz_wccb
[1] 933 845 722 521  46   1   1   1   1   1
 
best
Xueming
 


_______________________________________________
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]