cranly (version 0.5.4)

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

Description

Coerce a cranly_network to an igraph::graph object

Usage

# S3 method for 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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataCamp Workspace