[R] randomly sampling and visualizing 100 nodes in a citation network with igraph library
Rui Barradas
ru|pb@rr@d@@ @end|ng |rom @@po@pt
Sat May 4 00:27:05 CEST 2019
Hello,
Maybe you can sample from the vertices
subv <- sample(V(G), 100)
and then use something like [1] (StackOverflow).
[1]https://stackoverflow.com/questions/23682113/creating-subgraph-using-igraph-in-r
Hope this helps,
Rui Barradas
Às 22:02 de 03/05/19, Drake Gossi escreveu:
> Hello everyone,
>
> How would I randomly select 100 nodes to look at out of these approx.
> 25,0000? I'm practicing constructing a citation network.
>
> edgeList below is an edge list.
>
>> head (edgeList)
> to from
> [1,] "4US6" "3US320"
> [2,] "4US6" "4US1"
> [3,] "6US280" "1US393"
> [4,] "6US280" "1US53"
> [5,] "6US280" "3US133"
> [6,] "14US179" "5US321"
>
>> G <- graph.edgelist(edgeList, directed=FALSE)
>> G
> IGRAPH a473ce7 UN-- 25417 216738 --
> + attr: name (v/c)
> + edges from a473ce7 (vertex names):
> [1] 4US6 --3US320 4US6 --4US1 6US280 --1US393
> [4] 6US280 --1US53 6US280 --3US133 14US179--5US321
> [7] 14US179--9US262 15US45 --3US384 15US45 --4US436
> [10] 15US45 --4US441 15US45 --8US421 15US227--13US388
> [13] 15US227--2US36 15US290--7US220 9US262 --15US290
> [16] 15US369--11US504 15US369--11US577 15US369--5US137
> [19] 15US369--9US115 15US396--1US371 15US396--4US450
> [22] 15US396--6US358 15US396--7US73 16US1 --11US603
> + ... omitted several edges
>
> Can I use the sample () function? I'm working with the text Humanities
> Data in R (Arnold & Tilton). I'm working within the igraph library.
>
> Drake
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list