These functions reformat manynet-consistent data.

  • to_directed() reformats undirected network data to a directed network.

  • to_undirected() reformats directed network data to an undirected network, so that any pair of nodes with at least one directed edge will be connected by an undirected edge in the new network. This is equivalent to the "collapse" mode in {igraph}..

  • to_redirected() formats directed network data by flipping/transposing any existing direction such that senders become receivers and receivers become senders. This essentially has no effect on undirected networks or reciprocated ties.

  • to_reciprocated() reformats directed network data such that every directed tie is reciprocated.

  • to_acyclic() reformats network data to an acyclic graph.

If the format condition is not met, for example to_undirected() is used on a network that is already undirected, the network data is returned unaltered. No warning is given so that these functions can be used to ensure conformance.

Unlike the as_*() group of functions, these functions always return the same class as they are given, only transforming these objects' properties.

to_directed(.data)

to_undirected(.data)

to_redirected(.data)

to_reciprocated(.data)

to_acyclic(.data)

Arguments

.data

An object of a manynet-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

Value

All to_ functions return an object of the same class as that provided. So passing it an igraph object will return an igraph object and passing it a network object will return a network object, with certain modifications as outlined for each function.

Details

Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:

data.frameigraphmatrixnetworktbl_graph
to_undirected11111