| Crates.io | icentral-all-pairs-distance |
| lib.rs | icentral-all-pairs-distance |
| version | 0.1.0 |
| created_at | 2025-04-04 23:07:06.600165+00 |
| updated_at | 2025-04-04 23:07:06.600165+00 |
| description | A Rust crate for managing and manipulating all-pairs distance data in large graphs. |
| homepage | |
| repository | https://github.com/your-repo/icentral-all-pairs-distance |
| max_upload_size | |
| id | 1620964 |
| size | 58,079 |
icentral-all-pairs-distanceicentral-all-pairs-distance is a Rust crate designed to efficiently manage and manipulate all-pairs distance data in large graphs. It provides a robust structure, AllPairsDistances, that allows indexing, mutability, and creation of both mapped and indexed distance maps. The crate is useful in graph algorithms where distances between all pairs of nodes need to be stored and retrieved efficiently.
To include icentral-all-pairs-distance in your project, add the following to your Cargo.toml:
[dependencies]
icentral-all-pairs-distance = "0.1"
You can create a new AllPairsDistances instance either with a specific length or using the default, which is initialized with the name "default_all_pairs_distances".
use icentral_all_pairs_distance::AllPairsDistances;
fn main() {
// Create a new AllPairsDistances with a specific length
let distances = AllPairsDistances::new(10, "graph_distances");
// Access a distance between node pairs (immutable)
let dist: f64 = distances[(NodeId::new(0), NodeId::new(1))];
// Mutate the distance between node pairs
distances[(NodeId::new(0), NodeId::new(1))] = 3.5;
}
AllPairsDistances::new(len: usize, name: &str)
Creates a new AllPairsDistances instance with the specified size len and name. Each distance map is initialized with a size of len.
AllPairsDistances::len()
Returns the number of distance maps stored in the structure.
Default
Provides a default instance of AllPairsDistances with the name "default_all_pairs_distances".
CreateEmptyIndexed
Creates an indexed empty AllPairsDistances instance.
CreateEmptyMapped
Creates a mapped empty AllPairsDistances instance.
Index<(NodeId, NodeId)>
Provides immutable access to the distances between two nodes.
IndexMut<(NodeId, NodeId)>
Provides mutable access to the distances between two nodes.
This project is licensed under the MIT License.
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.