#geometry #optimization #steiner-tree

geosteiner

compute Euclidean and recitlinear Steiner trees using the geosteiner C library

1 unstable release

new 0.1.0 Mar 24, 2025

#257 in #geometry

CC-BY-4.0

2.5MB
64K SLoC

C 63K SLoC // 0.2% comments M4 267 SLoC // 0.2% comments Rust 193 SLoC // 0.0% comments Happy 176 SLoC C++ 114 SLoC // 0.3% comments Lex 65 SLoC // 0.1% comments Java 37 SLoC // 0.7% comments AWK 34 SLoC // 0.7% comments Shell 18 SLoC // 0.6% comments

Contains (autotools obfuscated code, 185KB) external/geosteiner-5.3/configure, (obscure autoconf code, 15KB) external/geosteiner-5.3/configure.ac

geosteiner bindings

crates.io crates.io docs.rs

Compute Euclidean and rectilinear minimum Steiner trees using safe bindings to the geosteiner C library.

Usage

The library provides two functions to compute the Euclidean and rectilinear minimum Steiner trees.

use geosteiner::euclidean_steiner_tree;

fn main() {
    let terms = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]];
    let tree = euclidean_steiner_tree(&terms);
    println!("found tree with length {}", tree.length);
    println!("steiner points: ");
    println!("{:.2?}", tree.steiner_points);
    println!("edges: ");
    println!("{:?}", tree.edges);
    println!("length: {:.2}", tree.length);
}

Safety

This crate is just a wrapper around the geosteiner C library. While care has been taken to ensure that all ffi calls are safe, the underlying C code may still contain bugs that could lead to memory unsafety. We take no responsibility for the geosteiner C library and state that its authors are unaffiliated with this crate.

License

Unfortunately, geosteiner itself is licensed under CC-BY-NC, so these bindings are limited to the same license.

No runtime deps

~0–2.2MB
~43K SLoC