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

View source: R/coerce.R

as.igraph.cranly_networkR Documentation

Coerce a cranly_network to an igraph::graph object

Description

Coerce a cranly_network to an igraph::graph object

Usage

## 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



## Package directives network
cran_db <- clean_CRAN_db()

package_network <- build_network(cran_db)
igraph::as.igraph(package_network)

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



ikosmidis/cranly documentation built on Aug. 30, 2022, 7:55 p.m.