plot_submodel_network: Visualize submodel networks

View source: R/plot_submodel_network.R

plot_submodel_networkR Documentation

Visualize submodel networks

Description

Visualize the output of frscore() and frscored_cna() by generating a network representation of submodel relations among the scored model types.

Usage

plot_submodel_network(
  x,
  show_clusters = TRUE,
  directed = FALSE,
  igraphlayout = TRUE,
  ...
)

Arguments

x

An object of class "frscore" or "frscored_cna".

show_clusters

Logical; should clusters be visualized?

directed

Logical; should submodel relations be represented as directional?

igraphlayout

Logical; should igraph layout be used?

...

additional arguments to visNetwork().

Details

plot_submodel_network() takes as input a results object returned by frscore() or frscored_cna(), and creates a network visualization of the submodel relations among the scored models using visNetwork(). The nodes of the network represent unique model types, and an edge between two nodes represents a submodel relation between those model types. By default, the edges of the network are undirected. Setting directed = TRUE creates a directed network with edges pointing from submodels to supermodels. As it is only the presence of and not the direction of submodel relations that matters for the fr-score of a model type, the directed network provides no additional information about fr-scores over and above the undirected network. By default, the network color-codes clusters of model types based on edge-betweenness, calculated with cluster_edge_betweenness() from the package igraph. The clusters are always based on undirected edge-betweenness to reflect the fact that only the presence of submodel-relations, not their direction, is relevant for fr-scores. The clusters can be turned off by setting show_clusters = FALSE. The network plot uses igraph layout by default, this can be changed to visNetwork default by setting igraphlayout = FALSE. The visualization can be customized by passing other visNetwork() arguments in ..., and by using other functions from the visNetwork package (see examples). The purpose of plot_submodel_network() is to provide a convenient way of visualizing submodel relations calculated by the frscore functions, at the expense of limited flexibility. For further analysis of the submodel network and more visualization options, ´submodel_adjacencies_to_igraph()´ produces an igraph graph of submodel relations from an adjacency matrix included in frscore() and frscored_cna() output.

Value

A visNetwork object.

Examples

r <- frscored_cna(d.error)
v <- plot_submodel_network(r)
v
# customize or override general options
v <- visNetwork::visOptions(v, highlightNearest = TRUE)
v

frscore documentation built on June 8, 2025, 12:59 p.m.