igraph-help
[Top][All Lists]
Advanced

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

[igraph] Question about the functions induced.subgraph() and clusters()


From: address@hidden
Subject: [igraph] Question about the functions induced.subgraph() and clusters()
Date: Fri, 21 Mar 2014 22:37:30 +0800

Hi
 
Is the question below out of that the vertice id has been changed in induced.subgraph()?
If I want to generate a subgraph which contains all the vertices and just delete the edges to make the vertices, which were meant to be delete, to be isolate?
 
best
Xueming
 

address@hidden
 
发件人: address@hidden
发送时间: 2014-03-21 22:00
收件人: igraph-help
主题: Question about the functions induced.subgraph() and clusters()
 
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
 

address@hidden

reply via email to

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