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

A tidygraph object modified as explained in the function description, details, or section.

Details

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

                data.frame igraph matrix network tbl_graph
to_acyclic               *      *      *       *         *
to_directed              *      *      *       *         *
to_reciprocated          *      *      *       *         *
to_redirected            *      *      *       *         *
to_undirected            *      *      *       *         *