Skip to content

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.

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) -> (links)

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
    }
) -> (links: dataset)

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.

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


links: dataset

A new dataset containing links (source, target and weight columns) between connected nodes.

Parameters


weight_factor: number = 1.0

Multiply link weights by this number.