Skip to main content

is_node_in_cycle

Function is_node_in_cycle 

Source
pub fn is_node_in_cycle(
    node_id: NodeId,
    circular_type: CircularType,
    graph: &CodeGraph,
    config: &CircularConfig,
) -> bool
Expand description

Check if a specific node is part of a cycle.

Uses SCC-based semantics consistent with find_all_cycles_graph. The node is considered in a cycle if it belongs to a strongly connected component (SCC) whose size meets the min_depth/max_depth criteria, or if it has a self-loop and include_self_loops is true.

§Arguments

  • node_id - The node to check for cycle membership
  • circular_type - The type of edges to follow (Calls, Imports, or Modules)
  • graph - The code graph to analyze
  • config - Configuration for min/max depth and self-loop inclusion

§Returns

true if the node is part of a cycle that meets the config criteria, false otherwise. Returns false for invalid or non-existent nodes.