The main entry point for cograph. Accepts adjacency matrices, edge lists, igraph, statnet network, qgraph, or tna objects and creates a visualization-ready network object.
Usage
cograph(
input,
layout = NULL,
directed = NULL,
nodes = NULL,
seed = 42,
simplify = FALSE,
...
)Arguments
- input
Network input. Can be:
A square numeric matrix (adjacency/weight matrix)
A data frame with edge list (from, to, optional weight columns)
An igraph object
A statnet network object
A qgraph object
A tna object
- layout
Layout algorithm name such as "circle", "oval", "spring", "groups", "grid", "random", "star", "bipartite" or "gephi" (see
list_layouts); a coordinate matrix or data frame; or an igraph layout function, name or two-letter code. Default NULL computes no layout. A layout can also be set later withsn_layout.- directed
Logical. Force directed interpretation. NULL for auto-detect.
- nodes
Node metadata. Can be NULL or a data frame with node attributes. If data frame has a
labelorlabelscolumn, those are used for display.- seed
Random seed for deterministic layouts. Default 42. Set NULL for random.
- simplify
Logical or character. Used for tna input only. If FALSE (default), every transition from tna sequence data is a separate edge. If TRUE or a string ("sum", "mean", "max", "min"), duplicate edges are aggregated, and TRUE uses "sum".
- ...
Additional arguments passed to the layout function.
Value
A cograph_network object. It is a list with the elements
nodes, edges, directed, weights,
data, meta and node_groups.
See also
splot for base R graphics rendering,
soplot for grid graphics rendering,
sn_nodes for node customization,
sn_edges for edge customization,
sn_layout for changing layouts,
sn_theme for visual themes,
sn_palette for color palettes,
from_qgraph and from_tna for converting external objects
Examples
cograph(regulation_net) |> splot(layout = "circle")
