#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CardSpec {
pub key: &'static str,
pub summary: &'static str,
pub operations: &'static [&'static str],
pub data_forms: &'static [&'static str],
pub limits: &'static str,
}
pub fn graph_cards() -> &'static [CardSpec] {
const CARDS: &[CardSpec] = &[CardSpec {
key: "discrete/graph",
summary: "Weighted graphs with traversal and connectivity.",
operations: &[
"bfs",
"dfs",
"connected-components",
"weakly-connected-components",
"strongly-connected-components",
],
data_forms: &["graph", "edge"],
limits: "Node identity is index-based; multiedges and self-loops are \
representable. Connectivity validates endpoints and fails closed \
on out-of-range nodes.",
}];
CARDS
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn graph_card_is_present_and_ascii() {
let cards = graph_cards();
assert_eq!(cards.len(), 1);
assert_eq!(cards[0].key, "discrete/graph");
assert!(cards[0].summary.is_ascii());
}
}