MCPcopy Create free account
hub / github.com/CodeSentryAI/lockbud / new

Method new

src/analysis/postdom/tests.rs:16–34  ·  view source on GitHub ↗
(start_node: usize, edges: &[(usize, usize)])

Source from the content-addressed store, hash-verified

14
15impl TestGraph {
16 pub fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
17 let mut graph = TestGraph {
18 num_nodes: start_node + 1,
19 start_node,
20 successors: FxHashMap::default(),
21 predecessors: FxHashMap::default(),
22 };
23 for &(source, target) in edges {
24 graph.num_nodes = max(graph.num_nodes, source + 1);
25 graph.num_nodes = max(graph.num_nodes, target + 1);
26 graph.successors.entry(source).or_default().push(target);
27 graph.predecessors.entry(target).or_default().push(source);
28 }
29 for node in 0..graph.num_nodes {
30 graph.successors.entry(node).or_default();
31 graph.predecessors.entry(node).or_default();
32 }
33 graph
34 }
35}
36
37impl DirectedGraph for TestGraph {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected