---
title: "Network simplification"
description: "Fix some contraction steps from index structure, then search the smaller remaining network."
eyebrow: "Network preprocessing"
---

## What simplification does {#rules}

Network simplification fixes some contraction steps from index structure, reducing the number of tensors in the subsequent search. This is structural preprocessing: it records which tensors can be combined first without reading or computing actual arrays. Numerical execution must still perform those fixed contractions.

`simplify` primarily checks these rules:

| Distinct indices currently retained by a tensor | Action |
| --- | --- |
| 0 | Combine with another tensor having the fewest current indices |
| 1 | Combine with a tensor sharing that index |
| 2 | Try combining with a neighbor, provided the result has no more indices than that neighbor |

Output indices and indices still used by other tensors are retained. These rules do not involve low-rank decomposition or singular-value truncation.

## Searching after simplification {#rust-usage}

```pseudocode
prefix, reduced, map = simplify the input network
reduced_path = search a contraction path on reduced
path = map reduced_path IDs back to the original network and append to prefix
stats = validate path and compute metrics on the original network
return path, stats
```

Simplification preserves the contraction expression but fixes some steps in advance, so it can change the path found by subsequent search.

### Simplification results {#result}

`prefix` stores fixed SSA steps; `reduced` is the reduced network; `map` associates reduced-network inputs with original-network nodes. `stitch` reconnects the subsequent path to the original network.

## Interfaces {#interfaces}

Call `simplify` and `stitch` separately, or use `random_greedy_simplified` to combine simplification, randomized greedy search, path stitching, and metric computation. Python `arctn_simplify` returns the simplified structure without executing arrays. See the [Rust API](/docs/rust-api#simplify) and [Python API](/docs/python-api#simplify) for parameters.
