Link rows by id¶
network
Create network links using one or more lists of target ids.
For each row this step iterates over the lists of IDs in one or more target columns, and if a ID exists also in the source column, the corresponding rows will be connected.
Note that while this step allows multiple input columns to be used as link targets, it does not allow for the
specification of link weights. See the step link_rows
for creating weighted networks. All link weights will
be set to 1.0 by default. But see the weight_factor param to specify another constant instead.
Usage¶
The following are the step's expected inputs and outputs and their specific types.
link_rows_by_id(
source_id: number|category,
*target_ids: number|category|list[number]|list[category],
{
"param": value
}
) -> (targets: column, weights: column)
where the object {"param": value}
is optional in most cases and if present may contain any of the parameters described in the
corresponding section below.
Example¶
Given a dataset ds
, where each row is associated with a twitter user (identified by column account_id
), the following line connects each of these users with other users specified in columns reply_ids
and mention_ids
.
link_rows_by_id(ds.account_id, ds.reply_ids, ds.mention_ids) -> (ds.targets, ds.weights)
Inputs¶
source_id: column:number|category
A column of IDs corresponding to the nodes/rows acting as the source of a link.
*target_ids: column:number|category|list[number]|list[category]
One or more columns of IDs (can be lists) corresponding to the target of a link.
Outputs¶
targets: column
A column containing for each item a list of row numbers identfying all other items it will be linked to.
weights: column
A column containing for each item a list of weights identfying the "importance" of each
link to other items identified in the targets
column (counting how many times a consecutive
pair of items was found together in the sequences).
Parameters¶
weight_factor: number = 1.0
Multiply link weights by this number.