identify_transitive_edges: Identify Transitive Edges

View source: R/transitive_reduction.R

identify_transitive_edgesR Documentation

Identify Transitive Edges

Description

Identifies which edges in a reachability matrix are transitive (can be inferred from other paths) versus direct (essential).

Usage

identify_transitive_edges(reach_matrix, adj_matrix = NULL)

Arguments

reach_matrix

A square reachability matrix (n x n) with 0/1 entries.

adj_matrix

Optional. The original adjacency matrix for comparison.

Details

This function is useful for understanding the structure of relationships and for creating visualizations where transitive edges are shown differently (e.g., as dashed lines) from direct edges.

Value

A data frame with columns:

  • from: source node index

  • to: target node index

  • from_label: source node label (if available)

  • to_label: target node label (if available)

  • type: "direct" or "transitive"

See Also

extract_direct_edges for removing transitive edges, plot_ism for visualization.

Examples

adj <- matrix(c(0, 1, 1,
                0, 0, 1,
                0, 0, 0), nrow = 3, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C")

reach <- compute_reachability(adj)
edges <- identify_transitive_edges(reach)
print(edges)

ISMtools documentation built on March 13, 2026, 1:06 a.m.