Files
graphify/tests/fixtures/sample.rs
T
Safi e7a03a0539 feat: cache, multi-language extraction, MCP, memory feedback
call-graph INFERRED edges, multi-language semantic extraction, SHA256 cache,
MCP stdio server with shortest_path, Q&A memory feedback loop
2026-04-04 18:56:38 +01:00

28 lines
539 B
Rust

use std::collections::HashMap;
struct Graph {
nodes: HashMap<String, Vec<String>>,
}
impl Graph {
fn new() -> Self {
Graph { nodes: HashMap::new() }
}
fn add_node(&mut self, id: String) {
self.nodes.insert(id, vec![]);
}
fn add_edge(&mut self, src: String, tgt: String) {
self.nodes.entry(src).or_default().push(tgt);
}
}
fn build_graph(edges: Vec<(String, String)>) -> Graph {
let mut g = Graph::new();
for (src, tgt) in edges {
g.add_edge(src, tgt);
}
g
}