| Crates.io | icentral-distances |
| lib.rs | icentral-distances |
| version | 0.1.0 |
| created_at | 2025-04-04 20:47:50.008233+00 |
| updated_at | 2025-04-04 20:47:50.008233+00 |
| description | Manage and manipulate distances within a graph or network context. Includes efficient distance storage and operations for pathfinding and graph traversal algorithms. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1620726 |
| size | 55,749 |
iCentral Distances is a Rust crate designed to manage and manipulate distances within a graph or network context. The crate implements a DistanceMap structure to efficiently store and update node distances, providing utilities for various distance comparisons and manipulations. This is particularly useful for algorithms dealing with pathfinding, graph traversal, or network analysis.
delegate_to_distances! facilitates ease of use and abstraction in repetitive distance operations.DistanceMap utilizes an MaybeIndexedMap<f64> to store distances associated with nodes in a graph.new_from_nodes, empty_indexed, empty_mapped, new for creating and initializing instances of DistanceMap.v_closer_than_u, is_farther_away, is_farther_than_one_away, is_one_step_away, functions for comparing node distances.set_distance_for_node, insert_node_at_infinite_distance, set_one_step_away, set_zero_distance, methods for setting or modifying distances.use icentral_distances::DistanceMap;
fn main() {
let nodes = vec![1, 2, 3, 4];
let mut distance_map = DistanceMap::new_from_nodes(nodes, "example_map");
// Set the distance for a node
distance_map.set_distance_for_node(1, 5.0);
// Check if one node is closer than another
let is_closer = distance_map.v_closer_than_u(2, 3);
println!("Node 2 is closer to the source than Node 3: {}", is_closer);
}
The DistanceMap leverages a flexible distance model which is compatible with both indexed and mapped representations. This adaptability makes it a suitable choice for diverse applications ranging from simple graphs to complex network simulations.
Contributions and feedback are welcome. Please open issues on the GitHub repository for bug reports or feature requests.
This README was generated by an AI model and may not be 100% accurate; however, it should be quite informative.
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.