r - delete vertices using which on igraph vector -
i trying delete vertices graph in igraph , not working. think issue might with
> toosmall <- which(v(g)$coreness.all <= 5)
as appears return integer(0).
how can remove vertices graph below?
> graph.coreness(g) [1] 1 19 1 3 17 19 5 19 19 19 19 7 19 18 17 12 12 19 19 17 16 19 3 3 7 12 18 4 5 12 12 3 1 6 19 5 19 19 3 19 17 17 19 19 5 1 1 7 8 19 1 2 [53] 7 3 17 5 4 19 3 16 1 3 13 3 14 10 10 13 8 18 18 12 6 10 12 14 11 16 12 7 5 7 5 10 15 16 10 3 5 5 16 16 16 13 16 16 16 16 16 15 10 6 2 1 [105] 14 16 16 11 5 11 16 11 10 16 2 14 7 8 1 10 12 12 12 19 8 10 7 5 13 3 19 16 3 4 4 19 13 7 16 13 11 13 15 13 3 2 3 3 2 9 14 16 16 14 16 13 [157] 13 15 13 11 12 11 1 1 11 19 7 3 19 3 7 5 19 19 19 19 19 19 19 18 19 11 13 17 4 19 16 19 11 9 9 12 19 16 11 19 4 7 4 19 6 6 9 2 15 8 7 5 [209] 10 7 3 10 6 8 4 11 13 2 7 6 7 6 9 4 3 3 13 3 13 9 4 13 5 5 6 6 6 14 8 2 5 7 7 14 7 9 6 8 12 1 1 1 14 1 10 8 16 2 6 9 [261] 3 7 14 16 15 2 5 1 4 7 17 7 6 4 11 8 9 15 4 4 15 1 5 5 3 6 1 2 2 4 4 1 5 1 6 1 5 5 3 2 3 3 6 6 6 3 2 8 5 6 3 3 [313] 2 1 5 2 12 3 1 6 1 2 5 2 1 3 1 1 8 2 3 > toosmall <- which(v(g)$coreness.all <= 5) > delete.vertices(g,toosmall) igraph u--- 331 2771 -- + attr: color (v/c), shape (v/c), size (v/c), opacity (v/c), image file (v/c), visibility (v/c), label (v/c), label fill color (v/c), label position (v/c), tooltip (v/c), layout order (v/c), x (v/c), y (v/c), locked? (v/c), polar r (v/c), polar angle (v/c), degree (v/c), in-degree (v/c), out-degree (v/c), betweenness centrality (v/c), closeness centrality (v/c), eigenvector centrality (v/c), pagerank (v/c), clustering coefficient (v/c), reciprocated vertex pair ratio (v/c), id (v/c), dynamic filter (v/c), add own columns here (v/c), followed (v/c), followers (v/c), tweets (v/c), favorites (v/c), time zone utc offset (seconds) (v/c), description (v/c), location (v/c), web (v/c), time zone (v/c), joined twitter date (utc) (v/c), user of interest? (v/c), custom menu item text (v/c), custom menu item action (v/c), id (v/c), color (e/c), width (e/c), style (e/c), opacity (e/c), visibility (e/c), label (e/c), label text color (e/c), label font size (e/c), reciprocated? (e/c), id (e/c), dynamic filter (e/c), add own columns here (e/c), relationship (e/c), relationship date (utc) (e/c), tweet (e/c), urls in tweet (e/c), domains in tweet (e/c), hashtags in tweet (e/c), tweet date (utc) (e/c), twitter page tweet (e/c), latitude (e/c), longitude (e/c), imported id (e/c), in-reply-to tweet id (e/c), edge weight (e/c) > g igraph u--- 331 2771 -- + attr: color (v/c), shape (v/c), size (v/c), opacity (v/c), image file (v/c), visibility (v/c), label (v/c), label fill color (v/c), label position (v/c), tooltip (v/c), layout order (v/c), x (v/c), y (v/c), locked? (v/c), polar r (v/c), polar angle (v/c), degree (v/c), in-degree (v/c), out-degree (v/c), betweenness centrality (v/c), closeness centrality (v/c), eigenvector centrality (v/c), pagerank (v/c), clustering coefficient (v/c), reciprocated vertex pair ratio (v/c), id (v/c), dynamic filter (v/c), add own columns here (v/c), followed (v/c), followers (v/c), tweets (v/c), favorites (v/c), time zone utc offset (seconds) (v/c), description (v/c), location (v/c), web (v/c), time zone (v/c), joined twitter date (utc) (v/c), user of interest? (v/c), custom menu item text (v/c), custom menu item action (v/c), id (v/c), color (e/c), width (e/c), style (e/c), opacity (e/c), visibility (e/c), label (e/c), label text color (e/c), label font size (e/c), reciprocated? (e/c), id (e/c), dynamic filter (e/c), add own columns here (e/c), relationship (e/c), relationship date (utc) (e/c), tweet (e/c), urls in tweet (e/c), domains in tweet (e/c), hashtags in tweet (e/c), tweet date (utc) (e/c), twitter page tweet (e/c), latitude (e/c), longitude (e/c), imported id (e/c), in-reply-to tweet id (e/c), edge weight (e/c) > g <- delete.vertices(g,toosmall) > g igraph u--- 331 2771 -- + attr: color (v/c), shape (v/c), size (v/c), opacity (v/c), image file (v/c), visibility (v/c), label (v/c), label fill color (v/c), label position (v/c), tooltip (v/c), layout order (v/c), x (v/c), y (v/c), locked? (v/c), polar r (v/c), polar angle (v/c), degree (v/c), in-degree (v/c), out-degree (v/c), betweenness centrality (v/c), closeness centrality (v/c), eigenvector centrality (v/c), pagerank (v/c), clustering coefficient (v/c), reciprocated vertex pair ratio (v/c), id (v/c), dynamic filter (v/c), add own columns here (v/c), followed (v/c), followers (v/c), tweets (v/c), favorites (v/c), time zone utc offset (seconds) (v/c), description (v/c), location (v/c), web (v/c), time zone (v/c), joined twitter date (utc) (v/c), user of interest? (v/c), custom menu item text (v/c), custom menu item action (v/c), id (v/c), color (e/c), width (e/c), style (e/c), opacity (e/c), visibility (e/c), label (e/c), label text color (e/c), label font size (e/c), reciprocated? (e/c), id (e/c), dynamic filter (e/c), add own columns here (e/c), relationship (e/c), relationship date (utc) (e/c), tweet (e/c), urls in tweet (e/c), domains in tweet (e/c), hashtags in tweet (e/c), tweet date (utc) (e/c), twitter page tweet (e/c), latitude (e/c), longitude (e/c), imported id (e/c), in-reply-to tweet id (e/c), edge weight (e/c) > toosmall integer(0)
i think have define toosmall
as:
toosmall <- which(graph.coreness(g) <= 5)
here worked example using constructed graph, use lower threshold deletion criterion:
# create graph g <- graph.ring(10) g <- add.edges(g, c(1,2, 2,3, 1,3)) graph.coreness(g) # identify vertices coresness <= threshold toosmall <- which(graph.coreness(g) <= 2) # delete vertices , plot gp <- delete.vertices(g, toosmall) plot(gp)
Comments
Post a Comment