9 releases (breaking)
new 0.7.0 | May 23, 2025 |
---|---|
0.6.0 | May 21, 2025 |
0.5.0 | May 18, 2025 |
0.4.0 | May 17, 2025 |
0.1.1 | Apr 29, 2025 |
#248 in Algorithms
1,244 downloads per month
370KB
5K
SLoC
Space Crate
A Rust library providing mathematical structures and operations for topological spaces, simplicial complexes, and graphs. This crate is designed to support computational topology and geometry applications.
Features
-
Topological Spaces: Implementation of fundamental topological concepts
- Sets with basic operations (union, intersection, difference)
- Topological spaces with neighborhoods and open sets
- Metric spaces with distance functions
- Normed and inner product spaces
-
Simplicial Complexes: Tools for working with simplicial complexes
- Simplex representation (points, edges, triangles, etc.)
- Chain complexes with boundary operations
- Support for arbitrary coefficient rings
-
Graph Theory: Flexible graph data structures
- Support for both directed and undirected graphs
- Basic graph operations and set operations
- Vertex and edge point representation
Usage
Topological Spaces
use harness_space::definitions::{Set, TopologicalSpace, MetricSpace};
// Define your own space type
struct MySpace {
// ... implementation details
}
struct MyPoint {
// ... implementation details
}
impl Set for MySpace {
type Point = MyPoint;
// ... implement set operations
}
impl TopologicalSpace for MySpace {
type Point = MyPoint;
type OpenSet = MyOpenSet;
// ... implement topological operations
}
Simplicial Complexes
use harness_space::complexes::simplicial::{Simplex, SimplicialComplex};
// Create a simplex (e.g., a triangle)
let triangle = Simplex::new(2, vec![0, 1, 2]);
// Create a simplicial complex
let mut complex = SimplicialComplex::new();
complex.join_simplex(triangle);
Graphs
use harness_space::graph::{Graph, Undirected};
use std::collections::HashSet;
// Create a graph
let mut vertices = HashSet::new();
vertices.insert(1);
vertices.insert(2);
let mut edges = HashSet::new();
edges.insert((1, 2));
let graph = Graph::<usize, Undirected>::new(vertices, edges);
Dependencies
~0.5–0.9MB
~17K SLoC