|
From: | giorgio delzeri |
Subject: | Re: [igraph] how to change attributes to a randomly selected nodes of a network in igraph |
Date: | Fri, 12 May 2017 00:09:56 +0200 |
1) The "i <- 3" is there because I assign the letters "A" and "B" already before the while loop; so then the following assignment will be "C" (i.e., the 3rd element/letter in the "cnames" vector)2) The 0.15 was included because I thought you wanted to sample only 15% of the nodes. I included "round" to avoid any potential issues with decimals, which I think is already handled by "sample" anyway.3) In the last 2 lines of code, I increment "i" so a new letter is chosen for the next "compartment". The line before that one is to assign that new compartment only if there is at least 1 sampled neighbor.4) No, the "unique" line does not remove vertices. The function "adjacent_vertices" returns a list (since "x" can be more than 1 node), so I "unlist" it to make it a numeric vector. I call "unique" to remove any possible duplicates.On Thu, May 11, 2017 at 4:00 PM, mario rossi <address@hidden> wrote:As you can see, I am not a good igraph expert ;-)Because in the algorithm I have not to change anything in the original network, I have only to "assign" attributes to the vertices...Is only an assignement, or not?This fuction does not remove any vertices or edges, I am right?I was reading more carefully your code, Chris.I noticed that there is " unique(unlist(adjacent_vertices(g, x))) ".
_______________________________________________
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
[Prev in Thread] | Current Thread | [Next in Thread] |