You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dependency_graph.rs
    path of file: ./repos/pavex/libs/pavexc/src/compiler/analyses/call_graph
    
    the code of the file until where you have to start completion: use std::fmt::Write;

use ahash::{HashMap, HashMapExt, HashSet, HashSetExt};
use indexmap::IndexSet;
use pavex_bp_schema::Lifecycle;
use petgraph::stable_graph::{NodeIndex, StableDiGraph};

use crate::compiler::analyses::components::{ComponentDb, ComponentId};
use crate::{
    compiler::{
        analyses::{
            components::HydratedComponent, computations::ComputationDb,
            constructibles::ConstructibleDb,
        },
        computation::Computation,
    },
    diagnostic::CompilerDiagnostic,
    language::ResolvedType,
};

use super::NumberOfAllowedInvocations;

/// A graph that represents the dependencies between components, ignoring their respective lifecycles.
/// There is at most one node for each [`ComponentId`].
///
/// The primary purpose of this graph is to determine i
    
fn find_cycles(graph: &RawDependencyGraph) -> Vec<Vec<NodeIndex>> {
    fn dfs(
        node_index: NodeIndex,
        graph: &RawDependencyGraph,
        visited: &mut HashSet<NodeIndex>,
        stack: &mut Vec<NodeIndex>,
        cycles: &mut Vec<Vec<NodeIndex>>,
    ) {
        visited.insert(node_index);
        stack.push(node_index);

        for neighbour_index in graph.neighbors_directed(node_index, petgraph::Direction::Outgoing) {
            if !visited.contains(&neighbour_index) {
                dfs(neighbour_index, graph, visited, stack, cycles);
            } else if let Some(cycle_start) = stack.iter().position(|&x| x == neighbour_index) {
                let cycle = stack[cycle_start..].to_vec();
                cycles.push(cycle);
            }
        }

        stack.pop();
    }

    let mut visited = HashSet::new();
    let mut stack = Vec::new();
    let mut cycles = Vec::new();

    for node_index in graph.node_indices() {
        if !visited.contains(&node_index) {
            dfs(node_index, graph, &mut visited, &mut stack, &mut cycles);
        }
    }

    cycles
}