Skip to contents

Core class representing a network for visualization. Stores nodes, edges, layout coordinates, and aesthetic mappings.

Active bindings

n_nodes

Number of nodes in the network.

n_edges

Number of edges in the network.

is_directed

Whether the network is directed.

has_weights

Whether edges have weights.

node_labels

Vector of node labels.

Methods


Method new()

Create a new CographNetwork object.

Usage

CographNetwork$new(input = NULL, directed = NULL, node_labels = NULL)

Arguments

input

Network input (matrix, edge list, or igraph object).

directed

Logical. Force directed interpretation. NULL for auto-detect.

node_labels

Character vector of node labels.

Returns

A new CographNetwork object.


Method clone_network()

Clone the network with optional modifications.

Usage

CographNetwork$clone_network()

Returns

A new CographNetwork object.


Method set_nodes()

Set nodes data frame.

Usage

CographNetwork$set_nodes(nodes)

Arguments

nodes

Data frame with node information.


Method set_edges()

Set edges data frame.

Usage

CographNetwork$set_edges(edges)

Arguments

edges

Data frame with edge information.


Method set_directed()

Set directed flag.

Usage

CographNetwork$set_directed(directed)

Arguments

directed

Logical.


Method set_weights()

Set edge weights.

Usage

CographNetwork$set_weights(weights)

Arguments

weights

Numeric vector of weights.


Method set_layout_coords()

Set layout coordinates.

Usage

CographNetwork$set_layout_coords(coords)

Arguments

coords

Matrix or data frame with x, y columns.


Method set_node_aes()

Set node aesthetics.

Usage

CographNetwork$set_node_aes(aes)

Arguments

aes

List of aesthetic parameters.


Method set_edge_aes()

Set edge aesthetics.

Usage

CographNetwork$set_edge_aes(aes)

Arguments

aes

List of aesthetic parameters.


Method set_theme()

Set theme.

Usage

CographNetwork$set_theme(theme)

Arguments

theme

CographTheme object or theme name.


Method get_nodes()

Get nodes data frame.

Usage

CographNetwork$get_nodes()

Returns

Data frame with node information.


Method get_edges()

Get edges data frame.

Usage

CographNetwork$get_edges()

Returns

Data frame with edge information.


Method get_layout()

Get layout coordinates.

Usage

CographNetwork$get_layout()

Returns

Data frame with x, y coordinates.


Method get_node_aes()

Get node aesthetics.

Usage

CographNetwork$get_node_aes()

Returns

List of node aesthetic parameters.


Method get_edge_aes()

Get edge aesthetics.

Usage

CographNetwork$get_edge_aes()

Returns

List of edge aesthetic parameters.


Method get_theme()

Get theme.

Usage

CographNetwork$get_theme()

Returns

CographTheme object.


Method set_layout_info()

Set layout info.

Usage

CographNetwork$set_layout_info(info)

Arguments

info

List with layout information (name, seed, etc.).


Method get_layout_info()

Get layout info.

Usage

CographNetwork$get_layout_info()

Returns

List with layout information.


Method set_plot_params()

Set plot parameters.

Usage

CographNetwork$set_plot_params(params)

Arguments

params

List of all plot parameters used.


Method get_plot_params()

Get plot parameters.

Usage

CographNetwork$get_plot_params()

Returns

List of plot parameters.


Method print()

Print network summary.

Usage

CographNetwork$print()


Method clone()

The objects of this class are cloneable with this method.

Usage

CographNetwork$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Create network from adjacency matrix
adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), nrow = 3)
net <- CographNetwork$new(adj)

# Access properties
net$n_nodes
#> [1] 3
net$n_edges
#> [1] 3
net$is_directed
#> [1] FALSE