| network_wrangling | R Documentation |
cograph provides verbs for reshaping a network. Each verb accepts any
supported input (matrix, edge list, igraph, statnet network, tna model,
cograph_network) and takes its options as named arguments. The
result is a cograph_network, or the input format when
keep_format = TRUE. as.data.frame() returns the edge or node
table of a result.
Each verb returns a cograph_network, except
split_components(), which returns a list of them. With
keep_format = TRUE a matrix, igraph, statnet network or tna input
comes back in that format. An edge-list data frame comes back as a
cograph_network with a warning.
filter_nodes(), select_nodes()Keep nodes by expression, name, index, top-N, neighborhood or component.
filter_edges(), select_edges()Keep edges by expression, endpoints, bridges, mutuality or top-N.
select_neighbors(), select_component(),
select_top(), select_k_core()Named shorthands for the common selections.
split_components()One network per connected component.
threshold_edges()Keep edges by weight, count, proportion or density.
binarize()Replace weights with 0/1.
symmetrize()Combine opposite arcs into one edge.
normalize_weights()Rescale by row, column, maximum, total, or to [0, 1].
invert_weights()Turn similarities into distances.
to_undirected(), to_directed(),
reverse_edges()Change directedness.
remove_isolates()Drop nodes with no edges.
contract_nodes()Collapse groups of nodes into one.
spanning_tree(),
complement_network()Derived graphs.
reorder_nodes(), rename_nodes()Change node order or labels without changing the network.
simplify()Merge duplicate edges and drop loops. It returns the input format.
add_nodes(), remove_nodes(),
add_edges(), remove_edges()Add and remove.
mutate_nodes(),
mutate_edges()Compute and store attributes.
bind_networks()Union, intersection or difference of two networks.
as_cograph(), to_matrix(),
to_igraph(), to_network(),
to_df(), and as.data.frame() on a
cograph_network (see as.data.frame.cograph_network).
Filtering edges does not remove nodes, as in
igraph::delete_edges() and tidygraph. Nodes left without edges
raise a cograph_isolates_created warning. They are dropped by
remove_isolates() or by keep_isolates = FALSE
in the verbs that have that argument.
The weight matrix of an undirected result is symmetric, so the result is still detected as undirected downstream.
Node groups, estimation data, layout coordinates and the original source type are carried through the verbs.
Unknown node names, out-of-range or fractional indices, unknown
measure names and a malformed between raise a
cograph_bad_selection error. The name argument of
select_nodes() is an exception. Unknown names in it are
skipped, and a warning is given when no node matches.
ego_networks(), shortest_paths(),
disparity_filter(), detect_communities(),
summarize_clusters(), aggregate_layers().
as.data.frame(threshold_edges(regulation_net, minimum = 0.2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.