> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphext.com/llms.txt
> Use this file to discover all available pages before exploring further.

# merge_links

> Merge multiple sets of network link columns into a single unified link set. 

Takes a dataset containing multiple pairs of link columns (targets + weights) and
combines them into a single pair. This is useful when you have links from different
sources (e.g., embedding similarity links and explicit foreign key links) and want
to visualize or analyze them as a single graph.

Each link pair can optionally be scaled by a weight multiplier, allowing you to
control the relative importance of different link sources.

## Usage

The following examples show how the step can be used in a recipe.

> [accordion] Examples
>
> > [tab] Example 1
> >
> > Merge embedding links with FK links, giving FK links 5x weight
> >
> > ```stan theme={null}
> > merge_links(ds[["semantic_targets", "semantic_weights", "fk_targets", "fk_weights"]], {
> >   "link_pairs": [["semantic_targets", "semantic_weights"], ["fk_targets", "fk_weights"]],
> >   "weight_multipliers": [1.0, 5.0]
> > }) -> (ds.targets, ds.weights)
> > ```
>
> > [tab] Example 2
> >
> > Merge three link sets with default weights
> >
> > ```stan theme={null}
> > merge_links(ds[["t1", "w1", "t2", "w2", "t3", "w3"]], {
> >   "link_pairs": [["t1", "w1"], ["t2", "w2"], ["t3", "w3"]]
> > }) -> (ds.targets, ds.weights)
> > ```
>
> > [tab] Signature
> >
> > General syntax for using the step in a recipe. Shows the inputs and outputs the step is expected to receive and will produce respectively. For futher details see sections below.
> >
> > ```stan theme={null}
> > merge_links(ds: dataset, {
> >     "param": value,
> >     ...
> > }) -> (targets: column, weights: column)
> > ```

## Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally
columns (`ds.first_name`), datasets (`ds` or `ds[["first_name", "last_name"]]`) or models (referenced
by name e.g. `"churn-clf"`).

> [accordion] Inputs
>
> **ds** `dataset` *required*
>
> A dataset containing the link column pairs to merge.

> [accordion] Outputs
>
> **targets** `column` *required*
>
> Merged list of linked row numbers.
>
> **weights** `column` *required*
>
> Merged list of weights for corresponding targets.

## Configuration

The following parameters can be used to configure the behaviour of the step by including them in
a json object as the last "input" to the step, i.e. `step(..., {"param": "value", ...}) -> (output)`.

> [accordion] Parameters
>
> **link\_pairs** `array[array]` *required*
>
> Pairs of \[target\_column, weight\_column] names to merge.
> Each entry is a two-element array with the names of the target and weight
> columns forming a link pair. E.g., \[\["targets\_a", "weights\_a"], \["targets\_b", "weights\_b"]].
>
> > [accordion] Array items
> >
> > **Item** `array[string]`
> >
> > Each item in array.
> >
> > > [accordion] Array items
> > >
> > > **Item** `string`
> > >
> > > Each item in array.
>
> **weight\_multipliers** `array[number]`
>
> Weight multiplier for each link pair.
> Optional list of multipliers (one per link pair). Each link pair's weights
> will be multiplied by the corresponding value. Defaults to 1.0 for all pairs.
>
> > [accordion] Array items
> >
> > **Item** `number`
> >
> > Each item in array.
> >
> > Values must be in the following range:
> >
> > ```javascript theme={null}
> > 0 ≤ Item < inf
> > ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.