# rsmt-ts

> A library to obtain Rectilinear Steiner Minimal Trees

Latest version **1.1.6** (published 2022-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install rsmt-ts
pnpm add rsmt-ts
yarn add rsmt-ts
bun add rsmt-ts
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2022-08-21 |
| First published | 2022-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 147.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Severin Ibarluzea |
| Maintainers | seveibar |
| Keywords | rsmt, steiner, tree |

## Links

- npm: https://www.npmjs.com/package/rsmt-ts
- Repository: https://github.com/seveibar/rsmt-ts
- Homepage: https://github.com/seveibar/rsmt-ts#readme
- Issues: https://github.com/seveibar/rsmt-ts/issues
- npm.io page: https://npm.io/package/rsmt-ts

## Dependencies (1)

- [glpk.js](https://npm.io/package/glpk.js.md) ^4.0.1

## Recent versions

- 1.1.6 (latest) — 2022-08-21
- 1.1.4 — 2022-08-21
- 1.1.3 — 2022-08-21
- 1.1.2 — 2022-08-21
- 1.1.1 — 2022-08-21
- 1.1.0 — 2022-08-21

## README

# Rectilinear Steiner Minimal Trees

> Note: I'm not the original author of this library. I wasn't able to
> find the source of the [original library](https://www.npmjs.com/package/rsmt), and wanted to update it, adding tests,
> making it work in browser and adding typescript support.

A library to obtain Rectilinear Steiner Minimal Trees.

For more info on the problem that this solves, check [Rectilinear Steiner tree](https://en.wikipedia.org/wiki/Rectilinear_Steiner_tree). This library implements a fast algorithm that provides exact (ie: minimal) solutions.

## Usage

To use it, just do:

```ts
import rsmt from `rsmt-ts`

const nodes = [[0, 0], [1, 2], [4, 1], ...]
const solution = await rsmt(nodes)

/*
solution = {
  terminals: [[0, 0], [1, 2], [4, 1], ...],
  steiners: [[0, 1], ...],
  edges: [[[0, 0], [0, 1]], ...],
  edgeIds: [[1, -1], ...]
}
*/
```

## Methods

| Method           | Description                                                                                                        |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ |
| `rsmt` (default) | Returns terminals, steiners and edges [(note: edges seem to have issues, see resolution)](./src/tests/mst.test.ts) |
| `mst`            | Compute edges of minimum spanning tree                                                                             |
| `getEdges`       | Returns all edges between all points                                                                               |

## Acknowledgements

This library is a reimplementation of the algorithms used in [GeoSteiner](http://www.geosteiner.com/), based on the paper "_A New Exact Algorithm for Rectilinear Steiner Trees_" (David M. Warme, 1997).

We also make use of an emscripten build of glpk, named [glpk.js](https://github.com/jvail/glpk.js/).

Thank you to [Glue Digital](glue.digital) who did the [original npm module.](https://www.npmjs.com/package/rsmt)

---
_Source: https://npm.io/package/rsmt-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
