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:55:34 -0400

On Fri, Mar 21, 2014 at 10:37 AM, address@hidden <address@hidden> wrote:
Hi
 
Is the question below out of that the vertice id has been changed in induced.subgraph()?

If I understand this question correctly, then yes. It creates another graph, internal vertex ids change.
 
G.
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
发送时间: 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
 


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