r - Plot only Edges with a specific weight - igraph -
i have large edge list, , plot edges have particular weight, how can that?
i have far tried
plot.graph(e(sgdf)[e(sgdf)$weight==3])) but error
error in v(g) : not graph object
copy graph first, remove edges don't need, , plot rest:
> sgdf.copy <- delete.edges(sgdf, which(e(sgdf)$weight != 3)-1) > plot(sgdf.copy) the -1 needed in delete.edges because igraph uses zero-based edge indices while r uses 1-based indices.
update: anonymous editor (whose edit sadly rejected) pointed out, igraph uses 1-base edge indices igraph 0.6 onwards. therefore, subtract 1 if using igraph 0.5.x or earlier.
Comments
Post a Comment