> ## 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.

# layout_igraph

> Calculate layout, i.e. node positions, for a network. 

Use igraph to create your own layout. Methods and possible parameters are described [here](https://igraph.org/python/doc/igraph.Graph-class.html#layout).

## Usage

The following example shows how the step can be used in a recipe.

<Accordion title="Examples" icon="code" defaultOpen="true">
  <Tabs>
    <Tab title="Example 1">
      The following configuration would allow smaller clusters and consider fewer of the data points as noise:

      ```stan theme={null}
      layout(links) -> (ds.x, ds.y)
      ```
    </Tab>

    <Tab title="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}
      layout_igraph(targets: list[number], *weights: list[number], {
          "param": value,
          ...
      }) -> (x: column, y: column)
      ```
    </Tab>
  </Tabs>
</Accordion>

## 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 title="Inputs" icon="right-to-bracket">
  <ParamField path="targets" type="column[list[number]]" required>
    A column containing link targets. Source is implied in the index.
  </ParamField>

  <ParamField path="*weights" type="column[list[number]]" />
</Accordion>

<Accordion title="Outputs" icon="right-from-bracket">
  <ParamField path="x" type="column" required>
    A numerical column with the x position of the calculated layout.
  </ParamField>

  <ParamField path="y" type="column" required>
    A numerical column with the y position of the calculated layout.
  </ParamField>
</Accordion>

## 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 title="Parameters" defaultOpen="true" icon="sliders">
  <ParamField path="method" type="string" default="fr">
    Algorithm to use.
    The name of a supported clustering algorithm (currently allows 'fr', 'fruchterman\_reingold', 'drl', 'sugiyama').

    Values must be one of the following:

    * `fr`
    * `fruchterman_reingold`
    * `drl`
    * `sugiyama`
  </ParamField>

  <ParamField path="directed" type="boolean" default="false">
    Links directed.
    Are the links directed (true) or not (false).
  </ParamField>

  <ParamField path="seed" type="integer" default="1">
    Seed.
    Seed to initialize the graph.
  </ParamField>
</Accordion>
