#graph-node #subgraph #half-edge #drawing #split #graph-structures #feynman-diagram

linnet

A library for working with half-edge data structures, and subgraphs, and drawing them

29 releases (14 breaking)

new 0.15.0 Dec 14, 2025
0.14.0 Nov 28, 2025
0.11.0 Jul 29, 2025
0.1.0 Mar 28, 2025

#700 in Data structures

Download history 141/week @ 2025-08-17 34/week @ 2025-08-24 59/week @ 2025-08-31 19/week @ 2025-09-07 23/week @ 2025-09-14 16/week @ 2025-09-21 38/week @ 2025-09-28 15/week @ 2025-10-05 22/week @ 2025-10-12 28/week @ 2025-10-19 14/week @ 2025-10-26 24/week @ 2025-11-02 18/week @ 2025-11-09 27/week @ 2025-11-23 9/week @ 2025-11-30

55 downloads per month
Used in 5 crates (3 directly)

MIT and GPL-2.0-or-later

1MB
20K SLoC

crates.io DOI

Linnet

Linnet is a graph library, specifically designed and developed to represent tensor networks and Feynman diagrams as used in projects like gammaloop and spenso.

The choice of a half-edge data structure is central to Linnet's design. This structure is exceptionally well-suited for these applications because it intrinsically supports the definition and manipulation of subgraphs that can be cleanly and efficiently "split" along edges (so that node degree is preserved).

All of the graph algorithms, iterators and graph manipulations operate at the level of subgraphs (which can also be the whole graph).

Key Features

  • Efficient Half-Edge Data Structure: Utilizes a half-edge representation, enabling efficient graph traversal, easy graph modifications like:
    • node identification
    • subgraph excision (splitting graphs in two)
    • graph joining along sewn along half edges
    • edge contraction
  • Subgraph Manipulation: Provides capabilities for defining, extracting, and analyzing various types of subgraphs, such as those induced by node properties, connectivity patterns (e.g., cycles, biconnected components), or graph cuts.
  • Graph Drawing & Visualization: Includes functionalities for generating visual representations of graphs. Provides graph layouting based on simulated annealing of pseudo spring forces.
  • Dot Parsing Integrates dot-parser curtesy of Martin Vassor integrated in a macro.

Getting Started

To start using Linnet in your Rust project, add it as a dependency in your Cargo.toml:

[dependencies]
linnet = "0.6.2"

Acknowledgement

This crate was written by Lucien Huber

Dependencies

~7–22MB
~305K SLoC