rshyper 0.0.3

This crate focuses on hypergraphs
Documentation

rshyper

crates.io docs.rs GitHub License


Warning: The library is currently in the early stages of development and is not yet ready for production use.

rshyper is a Rust library designed to provide a hypergraph implementation with a focus on performance and flexibility. It is built to handle complex relationships between data points efficiently, making it suitable for various applications in graph theory, data analysis, and more.

Features

  • hash - A hash-based hypergraph implementation.

Getting Started

Building from the source

Start by cloning the repository

git clone https://github.com//rshyper.git
cd rshyper

Building the project

cargo build --all-features -r -v --workspace

Running tests

cargo test --all-features -r -v --workspace

Usage

Add this to your Cargo.toml:

[dependencies.rshyper]
features = []
version = "0.0.x"

Examples

Example #1: Basic Usage

    extern crate rshyper;

    fn main() -> anyhow::Result<()> {
        let mut graph = HashGraph::<()>::new();

        // Add some vertices
        let v0 = graph.add_vertex_default();
        let v1 = graph.add_vertex_default();
        let v2 = graph.add_vertex_default();
        let v3 = graph.add_vertex_default();

        // add hyperedges
        let e1 = graph.add_hyperedge(vec![v0, v1, v2])?;
        let e2 = graph.add_hyperedge(vec![v1, v2, v3])?;
        // Get neighbors of vertex v1
        let neighbors = graph.get_neighbors(v1)?;
        // Get degree of vertex v1
        let degree = graph.vertex_degree(v1)?;
        // Remove a vertex
        graph.remove_vertex(v2)?;
        println!("\n****** Final Graph State ******\n{state:?}", state = graph);
        Ok(())
    }

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.