plot_ism: Plot ISM Structure

View source: R/plot_ism.R

plot_ismR Documentation

Plot ISM Structure

Description

Visualizes the Interpretive Structural Model (ISM) as a hierarchical diagram. By default, only essential edges are shown (transitive edges removed) for cleaner visualization suitable for publications.

Usage

plot_ism(
  reach_matrix,
  levels = NULL,
  show_transitive = FALSE,
  use_igraph = FALSE,
  node_labels = NULL,
  main = "ISM Hierarchical Structure",
  ...
)

Arguments

reach_matrix

A square reachability matrix (n x n) with 0/1 entries, typically computed using compute_reachability.

levels

Optional. An object of class ism_levels from level_partitioning. If NULL, it will be computed automatically.

show_transitive

Logical. If FALSE (default), transitive edges are removed for cleaner visualization. If TRUE, all edges are shown.

use_igraph

Logical. If TRUE and igraph is available, use igraph for plotting. If FALSE (default), use base R graphics.

node_labels

Optional character vector of node labels. If NULL, uses matrix row names or numeric indices.

main

Title for the plot. Default is "ISM Hierarchical Structure".

...

Additional arguments passed to plotting functions.

Details

The function performs transitive reduction by default, removing edges that can be inferred from other paths. This produces cleaner diagrams that are more suitable for academic publications and presentations.

Two plotting backends are available:

  • Base R (default): No additional packages required. Nodes are arranged in horizontal levels with arrows showing relationships.

  • igraph: Requires the igraph package. Provides more sophisticated graph layouts and styling options.

Value

Invisibly returns a list containing:

  • levels: the level partitioning result

  • edges: data frame of edges used in the plot

  • reduced_matrix: the adjacency matrix after transitive reduction

See Also

plot_interactive_ism for interactive visualization, compute_reachability for computing reachability matrices, level_partitioning for hierarchical decomposition, extract_direct_edges for transitive reduction.

Examples

# Create adjacency matrix
adj <- matrix(c(0, 1, 0, 0,
                0, 0, 1, 1,
                0, 0, 0, 0,
                0, 0, 0, 0), nrow = 4, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C", "D")

# Compute reachability
reach <- compute_reachability(adj)

# Plot ISM structure (base R, transitive edges removed)
plot_ism(reach)

# Show all edges including transitive ones
plot_ism(reach, show_transitive = TRUE)


# Use igraph if available
plot_ism(reach, use_igraph = TRUE)


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