Learn R Programming

cograph (version 2.7.2)

reverse_edges: Reverse Edge Direction

Description

Transposes the weight matrix, so every arc runs the other way. TNA users reach for this to look at where transitions came from rather than where they went.

Usage

reverse_edges(x, keep_format = FALSE, directed = NULL)

Value

A cograph_network with every edge reversed, or the input format when keep_format = TRUE. An undirected network is returned unchanged, with a cograph_no_effect warning.

Arguments

x

Network input.

keep_format

Logical. Return the input format when TRUE.

directed

Logical or NULL. If NULL (default), auto-detect.

See Also

to_directed, to_undirected

Examples

Run this code
adj <- matrix(c(0, .5, 0,
                0, 0, .7,
                0, 0, 0), 3, 3, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C")

reverse_edges(adj)

Run the code above in your browser using DataLab