MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / get_reachable_nodes

Function get_reachable_nodes

src/analysis/header.rs:269–294  ·  view source on GitHub ↗

Helper function: get all nodes reachable from a given node

(
    start: &'a str, 
    includes_map: &HashMap<&'a str, HashSet<&'a str>>
)

Source from the content-addressed store, hash-verified

267
268// Helper function: get all nodes reachable from a given node
269fn get_reachable_nodes<'a>(
270 start: &'a str,
271 includes_map: &HashMap<&'a str, HashSet<&'a str>>
272) -> HashSet<&'a str> {
273 let mut reachable = HashSet::new();
274 let mut stack = vec![start];
275 let mut visited = HashSet::new();
276
277 while let Some(current) = stack.pop() {
278 if visited.contains(current) {
279 continue;
280 }
281 visited.insert(current);
282 reachable.insert(current);
283
284 if let Some(children) = includes_map.get(current) {
285 for &child in children {
286 if !visited.contains(child) {
287 stack.push(child);
288 }
289 }
290 }
291 }
292
293 reachable
294}
295
296
297fn is_a_lib_header(name: &str) -> bool {

Callers 1

get_independent_headersFunction · 0.85

Calls 2

popMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected