as.igraph.cranly_network: Coerce a 'cranly_network' to an 'igraph::graph' object

Description Usage Arguments Details Examples

View source: R/coerce.R

Description

Coerce a cranly_network to an igraph::graph object

Usage

1
2
## S3 method for class 'cranly_network'
as.igraph(x, reverse = FALSE, ...)

Arguments

x

a cranly_network object.

reverse

logical. Should the direction of the edges be reversed? See details. Default is TRUE.

...

currently not used.

Details

The convention for a cranly_network object with perspective = "package" is that the direction of an edge is from the package that is imported by, suggested by, enhances or is a dependency of another package, to the latter package. reverse reverses that direction to correctly compute relevant network summaries (see summary.cranly_network). reverse is only relevant when the attr(x, "perspective") is "package" and is ignored when attr(x, "perspective") is "author", in which case the resulting igraph::graph object represents an undirected network of authors.

Examples

1
2
3
4
5
6
7
8
cran_db <- clean_CRAN_db()
# Package directives network
package_network <- build_network(object = cran_db, perspective = "package")
igraph::as.igraph(package_network)

## Author collaboration network
author_network <- build_network(object = cran_db, perspective = "author")
igraph::as.igraph(author_network)

cranly documentation built on Oct. 9, 2019, 1:04 a.m.