icentral-node-queue

Crates.ioicentral-node-queue
lib.rsicentral-node-queue
version0.1.0
created_at2025-04-04 21:00:04.137875+00
updated_at2025-04-04 21:00:04.137875+00
descriptionEfficient and dependable queue management for node identifiers, ideal for graph operations such as BFS.
homepage
repository
max_upload_size
id1620746
size52,113
(klebs6)

documentation

README

icentral-node-queue

icentral-node-queue is a Rust crate designed to manage a queue of node identifiers (NodeId) efficiently and reliably. This crate offers a robust NodeIdQueue struct along with a macro delegate_to_bfs_queue to facilitate the implementation of the Breadth-First Search (BFS) algorithm.

NodeIdQueue acts as a named queue, allowing you to store and manage node identifiers, imperative for graph traversal and related operations.

Features

  • Queue Operations: Supports common queue operations such as enqueue, dequeue, and peek.
  • Named Queues: Each queue is identifiable by a unique string name, making management of multiple queues straightforward.
  • Creation Methods: Easily instantiate named empty queues or start a new queue with an initial node.
  • Debugging: Built-in debug logs give detailed insights into queue operations, fostering efficient error tracking and debugging.

Usage

To utilize the icentral-node-queue, you must include it in your Cargo.toml dependencies:

[dependencies]
icentral-node-queue = "0.1.0"

Example

use icentral_node_queue::{NodeIdQueue, delegate_to_bfs_queue};

fn main() {
    let first_node = NodeId::new(1);
    let mut queue = NodeIdQueue::new(first_node, "example_queue");

    // Enqueue a node
    queue.enqueue(NodeId::new(2));

    // Peek at the first node in the queue
    if let Some(node) = queue.peek() {
        println!("Next node in queue: {:?}", node);
    }

    // Dequeue a node
    if let Some(dequeued_node) = queue.dequeue() {
        println!("Dequeued node: {:?}", dequeued_node);
    }
}

License

This project is licensed under the MIT License. See the LICENSE file for details.


Note: This README.md file was generated by an AI model and may not be 100% accurate; however, it should be pretty good.

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.

Commit count: 0

cargo fmt