An open API service indexing awesome lists of open source software.

https://github.com/habedi/graphina

A high-level graph mining and network analysis library for Rust :crab:
https://github.com/habedi/graphina

crates-io data-mining-algorithms data-science graph-algorithms graph-theory network-analysis rust-lang social-network-analysis

Last synced: 2 months ago
JSON representation

A high-level graph mining and network analysis library for Rust :crab:

Awesome Lists containing this project

README

        

# Graphina

[![Tests](https://img.shields.io/github/actions/workflow/status/habedi/graphina/tests.yml?label=tests&style=popout-square&logo=github)](https://github.com/habedi/graphina/actions/workflows/tests.yml)
[![Lint](https://img.shields.io/github/actions/workflow/status/habedi/graphina/lint.yml?label=lints&style=popout-square&logo=github)](https://github.com/habedi/graphina/actions/workflows/lint.yml)
[![Code Coverage](https://img.shields.io/codecov/c/github/habedi/graphina?style=popout-square&logo=codecov)](https://codecov.io/gh/habedi/graphina)
[![CodeFactor](https://img.shields.io/codefactor/grade/github/habedi/graphina?style=popout-square&logo=codefactor)](https://www.codefactor.io/repository/github/habedi/graphina)
[![Crates.io](https://img.shields.io/crates/v/graphina.svg?style=popout-square&color=fc8d62&logo=rust)](https://crates.io/crates/graphina)
[![Docs.rs](https://img.shields.io/badge/docs.rs-graphina-66c2a5?style=popout-square&logo=docs.rs)](https://docs.rs/graphina)
[![Downloads](https://img.shields.io/crates/d/graphina?style=popout-square&logo=rust)](https://crates.io/crates/graphina)
[![MSRV](https://img.shields.io/badge/MSRV-1.83.0-orange?style=popout-square&logo=rust&label=msrv)](https://github.com/rust-lang/rust/releases/tag/1.83.0)
[![Docs](https://img.shields.io/badge/docs-latest-3776ab?style=flat&logo=readthedocs)](docs)
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-007ec6?style=flat&logo=open-source-initiative)](https://github.com/habedi/graphina)

Graphina is a graph data science library for Rust.
It provides the common data structures and algorithms used for analyzing the graphs of real-world networks such as
social, transportation, and biological networks.

Compared to other Rust graph libraries like [petgraph](https://github.com/petgraph/petgraph)
and [rustworkx](https://www.rustworkx.org/), Graphina aims to provide a more high-level API and a wide range of
ready-to-use algorithms for network analysis and graph mining tasks.

> [!IMPORTANT]
> Graphina is in the early stages of development, so breaking changes may occur.

## Structure

Graphina consists of two main parts: a core library and extensions.
The core library provides the basic data structures and algorithms for working with graphs.
The extensions are modules outside the core library that contain more advanced algorithms for specific tasks like
community detection, link prediction, and calculating node and edge centrality scores.

The extensions are independent of each other. However, they depend on the core library for the basic graph operations.

### Graphina Core

| Module | Features/Algorithms | Status | Notes |
|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|---------------------------------------------------|
| [**Types**](src/core/types.rs) |


  • Directed and undirected graphs

  • Weighted and unweighted graphs

| Tested | Core graph types |
| [**Exceptions**](src/core/exceptions.rs) |
  • List of exceptions
| Tested | Custom error types for Graphina |
| [**IO**](src/core/io.rs) |

  • Edge list

  • Adjacency list

| Tested | I/O routines for reading/writing graph data |
| [**Generators**](src/core/generators.rs) |

  • Erdős–Rényi graph

  • Watts–Strogatz graph

  • Barabási–Albert graph

  • Complete graph

  • Bipartite graph

  • Star graph

  • Cycle graph

| Tested | Graph generators for random and structured graphs |
| [**Paths**](src/core/paths.rs) |

  • Dijkstra’s algorithm

  • Bellman–Ford algorithm

  • Floyd–Warshall algorithm

  • Johnson’s algorithm

  • A* search algorithm

  • Iterative deepening A*

| Tested | Shortest paths algorithms |
| [**MST**](src/core/mst.rs) |

  • Prim’s algorithm

  • Kruskal’s algorithm

  • Borůvka’s algorithm

| Tested | Minimum spanning tree algorithms |
| [**Traversal**](src/core/traversal.rs) |

  • Breadth-first search (BFS)

  • Depth-first search (DFS)

  • Iterative deepening DFS

  • Bidirectional search

| Tested | Graph traversal algorithms |

### Extensions

| Module | Features/Algorithms | Status | Notes |
|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|-----------------------------------------------------------|
| [**Centrality**](src/centrality/algorithms.rs) |


  • Degree centrality

  • Closeness centrality

  • Betweenness centrality

  • Eigenvector centrality

  • PageRank centrality

  • Katz centrality

  • Harmonic centrality

  • Local/global reaching centrality

  • VoteRank centrality

  • Laplacian centrality

| | Centrality measures |
| [**Links**](src/links/algorithms.rs) |

  • Resource allocation index

  • Jaccard coefficient

  • Adamic–Adar index

  • Preferential attachment

  • CN Soundarajan–Hopcroft

  • RA Index Soundarajan–Hopcroft

  • Within–inter-cluster ratio

  • Common neighbor centrality

| | Link prediction algorithms |
| [**Community**](src/community/algorithms.rs) |

  • Label Propagation

  • Louvain Method

  • Girvan–Newman algorithm

  • Spectral Clustering

  • Personalized PageRank

  • Infomap

  • Connected components

| | Community detection and clustering algorithms |
| [**Approximation**](src/approximation/algorithms.rs) |

  • Local node connectivity (BFS-based)

  • Maximum independent set (greedy with neighbor caching)

  • Maximum clique (greedy heuristic)

  • Clique removal

  • Large clique size

  • Average clustering coefficient

  • Densest subgraph (greedy peeling)

  • Diameter lower bound

  • Minimum weighted vertex cover (greedy re‑evaluated)

  • Minimum maximal matching (greedy)

  • Approximate Ramsey R2

  • TSP approximations (greedy, simulated annealing, threshold accepting, Christofides placeholder)

  • Treewidth decompositions (min degree, min fill-in)

| | Approximations and heuristic methods for NP‑hard problems |

> [!NOTE]
> Status shows whether the module is tested and benchmarked.
> Empty status means the module is implemented but not tested and benchmarked yet.

## Installation

```
cargo add graphina
```

*Graphina requires Rust 1.83 or later.*

## Documentation

See the [docs](docs/README.md) for the latest documentation.

Check out the [docs.rs/graphina](https://docs.rs/graphina) for the latest API documentation.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to make a contribution.

## License

This project is licensed under either of these:

* MIT License ([LICENSE-MIT](LICENSE-MIT))
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))