• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kaidokert / heapless-graphs-rs / 15665122570

15 Jun 2025 04:21PM UTC coverage: 93.713% (+4.5%) from 89.24%
15665122570

Pull #8

github

web-flow
Move heapless src/algorithms/traversal.rs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Pull Request #8: No ref graphs

3389 of 3461 new or added lines in 26 files covered. (97.92%)

41 existing lines in 7 files now uncovered.

5128 of 5472 relevant lines covered (93.71%)

44.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/algorithms.rs
1
// SPDX-License-Identifier: Apache-2.0
2

3
//! Provides some common graph algorithms
4
//!
5
//! Sample implementations of frequently used graph algorithms.
6
//!
7
//! Note: These are not necessarily efficient implementations,
8
//! nor thoroughly tested.
9

10
mod bellman_ford;
11
mod connected_components;
12
mod dijkstra;
13
mod greedy_coloring;
14
mod kahns;
15
mod kruskals;
16
mod tarjan_scc;
17
mod topological_sort;
18
mod traversal;
19

20
pub use bellman_ford::bellman_ford;
21
pub use connected_components::{connected_components, count_connected_components};
22
pub use dijkstra::dijkstra;
23
pub use greedy_coloring::greedy_color;
24
pub use kahns::kahns;
25
pub use kruskals::kruskals;
26
pub use tarjan_scc::{count_tarjan_scc, tarjan_scc};
27
pub use topological_sort::topological_sort_dfs;
28
pub use traversal::{bfs, bfs_unchecked, dfs_iterative, dfs_recursive, dfs_recursive_unchecked};
29

30
use crate::edgelist::edge_list::EdgeListError;
31
use crate::edges::EdgeNodeError;
32
use crate::graph::{GraphError, NodeIndex};
33

34
/// Errors that can occur during graph algorithm execution
35
///
36
/// This enum represents various error conditions that may arise when running
37
/// graph algorithms, including capacity limitations and graph-related errors.
38
#[derive(Debug, Clone, Copy, PartialEq)]
39
pub enum AlgorithmError<NI: NodeIndex> {
40
    /// Queue capacity exceeded during breadth-first operations
41
    QueueCapacityExceeded,
42
    /// Stack capacity exceeded during depth-first operations
43
    StackCapacityExceeded,
44
    /// Buffer for edges too small
45
    EdgeCapacityExceeded,
46
    /// Cycle detected in algorithm that requires acyclic graph
47
    CycleDetected,
48
    /// Output buffer too small
49
    ResultCapacityExceeded,
50
    /// Invalid algorithm state (e.g., empty stack when expecting nodes)
51
    InvalidState,
52
    /// Graph operation error
53
    GraphError(GraphError<NI>),
54
    /// Edge node error
55
    EdgeNodeError(EdgeNodeError),
56
}
57

58
impl<NI: NodeIndex> From<GraphError<NI>> for AlgorithmError<NI> {
59
    fn from(e: GraphError<NI>) -> Self {
×
60
        AlgorithmError::GraphError(e)
×
61
    }
×
62
}
63

64
impl<NI: NodeIndex> From<EdgeListError<NI>> for AlgorithmError<NI> {
65
    fn from(e: EdgeListError<NI>) -> Self {
1✔
66
        match e {
1✔
NEW
67
            EdgeListError::GraphError(ge) => AlgorithmError::GraphError(ge),
×
68
            EdgeListError::EdgeNodeError(ene) => AlgorithmError::EdgeNodeError(ene),
1✔
69
        }
70
    }
1✔
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc