#graph #algorithm #brandes #centrality #betweenness

icentral-fast-brandes

Efficient Rust implementation of Brandes algorithm for computing betweenness centrality on graphs with support for complex structures

1 unstable release

0.1.0 Apr 4, 2025

#7 in #betweenness

Download history 125/week @ 2025-04-02 12/week @ 2025-04-09

137 downloads per month
Used in icentral

MIT/Apache

18KB

Icentral-Fast-Brandes

Overview

The icentral-fast-brandes crate offers an efficient Rust implementation of computing betweenness centrality using the renowned Brandes algorithm. This metric is pivotal in network analysis, particularly in relation to determining the influence or importance of particular nodes within a graph structure.

Betweenness centrality is computed by assessing the frequency at which a node acts as a bridge along the shortest path between other nodes in the graph. This crate streamlines the process, enabling scalable calculations suitable for large graphs and complex structures.

Features

  • Speed and Efficiency: Utilizes Brandes algorithm, optimized for performance.
  • Comprehensive Graph Support: Compatible with any graph structure satisfying the required traits such as CreateScoresVector and NumNodes.
  • Customizable Workspace: Leverages ICentralWorkspace to dynamically allocate resources during computation.

Usage

To calculate betweenness centrality with icentral-fast-brandes, ensure your graph type fulfills the necessary trait bounds including, but not limited to, CreateScoresVector, Debug, NumNodes, MappedNodes, GetNodeIdRange, GetNeighborsForNode, and GetEdges.

Here's an example of how to use the core function:

use icentral_fast_brandes::fast_brandes_bc;

fn main() -> Result<(), BetweennessCentralityError> {
    let graph = /* initialize your graph data structure here */;
    let scores = fast_brandes_bc(&graph)?;
    println!("Betweenness Centrality Scores: {:?}", scores);
    Ok(())
}

Advanced Concepts

Brandes Algorithm

The Brandes algorithm efficiently computes the shortest paths and subsequently derives the betweenness centrality by an incremental summation of dependencies. Due to its heavy reliance on Dijkstra's or BFS depending upon the graph's nature (weighted or unweighted), it demonstrates significant advantages in computational efficiency over simpler methods.

Getting Started

To include icentral-fast-brandes in your project, add the following to your Cargo.toml:

[dependencies]
icentral-fast-brandes = "0.1.0"

Contributing

Contributions are welcome. Please open issues and create pull requests as needed. Let's build a decisive tool for network analysis together.


Note: This README was generated by an AI model and may not be 100% accurate. However, it should provide a comprehensive and useful introduction to the crate.

This crate is in the process of being translated from c++ to rust. Currently, it still needs exhaustive testing. It is likely there currently exist many glitches which need to be fixed before proper usage. This crate is based on the original icentral program developed by Fuad Jamor. Please see the following repository for details: https://github.com/fjamour/icentral.

For progress updates, see the workspacer rust project.

Dependencies

~16–25MB
~373K SLoC