reverse_edges: Reverse Edge Direction

View source: R/wrangle-structure.R

reverse_edgesR Documentation

Reverse Edge Direction

Description

Swaps the endpoints of every edge, which transposes the weight matrix. In a transition network the reversed arcs show where each transition came from. Additional edge columns are kept.

Usage

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

Arguments

x

Network input.

keep_format

Logical. If TRUE, a matrix, igraph, statnet network or tna input is returned in its own format. An edge-list data frame or a qgraph object is returned as a cograph_network with a cograph_no_format_roundtrip warning. Default FALSE returns a cograph_network.

directed

Logical or NULL. Directedness used to read the input. NULL (default) detects it from the input.

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.

See Also

to_directed, to_undirected

Examples

reverse_edges(regulation_net)

cograph documentation built on Nov. 19, 2026, 5:07 p.m.