[R] randomly sampling and visualizing 100 nodes in a citation network with igraph library

Drake Gossi dr@ke@go@@| @end|ng |rom gm@||@com
Fri May 3 23:02:31 CEST 2019

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.


More information about the R-help mailing list