normalize_sgmwcs_instance: Helper function to convert an igraph object into a proper SGMWCS instance
Description
This function generates new igraph object with additional signals field added.
The way the instance is constructed is defined by the function parameters.
Nodes and edges are grouped separately, grouping columns are defined
by nodes.group.by and edges.group.by arguments. group.only.positive param specifies
whether to group only positive-weighted (specified by nodes/edges.weight.column) nodes and edges.
Usage
normalize_sgmwcs_instance(
g,
nodes.weight.column = "weight",
edges.weight.column = "weight",
nodes.group.by = "signal",
edges.group.by = "signal",
group.only.positive = TRUE
)
Value
An igraph object with proper attributes set.
Arguments
- g
Graph to convert
- nodes.weight.column
Nodes column name (e.g. weight, score, w) for scoring
- edges.weight.column
Edges column name for scoring
- nodes.group.by
Nodes grouping column (e.g. signal, group, class)
- edges.group.by
Edges grouping column
- group.only.positive
Whether to group only positive-scored nodes/edges#'
Examples
Run this codedata("gatom_example")
normalize_sgmwcs_instance(gatom_example)
Run the code above in your browser using DataLab