Skip to main content

build_duplicate_groups_graph

Function build_duplicate_groups_graph 

Source
pub fn build_duplicate_groups_graph(
    dup_type: DuplicateType,
    graph: &CodeGraph,
    config: &DuplicateConfig,
) -> Vec<DuplicateGroup>
Expand description

Find all duplicate groups in the graph.

Groups nodes by a hash computed from their metadata, based on the duplicate type:

  • Body: Hash includes kind, signature (or name + line span), for functions/methods
  • Signature: Hash includes only the signature string
  • Struct: Hash includes only the name, for structs/classes only

§Arguments

  • duplicate_type - The type of duplication to detect (Body, Signature, or Struct)
  • graph - The code graph to analyze
  • config - Configuration for exact matching and result limits

§Returns

A vector of DuplicateGroup structs, each containing a list of node IDs that share the same hash. Groups are sorted by size (largest first) and limited by config.max_results. Single-node “groups” are filtered out.