MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / find_hamiltonian_cycle

Method find_hamiltonian_cycle

src/backtracking/hamiltonian_cycle.rs:131–156  ·  view source on GitHub ↗

Attempts to find a Hamiltonian cycle in the graph, starting from the specified vertex. A Hamiltonian cycle visits every vertex exactly once and returns to the starting vertex. # Note This implementation may not find all possible Hamiltonian cycles. It stops as soon as it finds one valid cycle. If multiple Hamiltonian cycles exist, only one will be returned. # Returns `Ok(Some(path))` if a Hami

(
        &self,
        start_vertex: usize,
    )

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

find_hamiltonian_cycleFunction · 0.80

Calls 3

pushMethod · 0.80
num_verticesMethod · 0.45

Tested by

no test coverage detected