Skip to content

Topology

osa_tool.operations.codebase.docstring_generation.topology

DependencyGraph

Builds and manages dependency graph for functions/methods.

The graph represents "who calls whom" relationships where: - Node: unique identifier for a function/method (file_path:function_name) - Edge: A → B means "A calls B" (A depends on B)

Topological sort ensures B is processed before A.

__init__(parsed_structure)

Initialize dependency graph from parsed structure.

Parameters:

Name Type Description Default
parsed_structure dict

Output from OSA_TreeSitter.analyze_directory() Format: {file_path: {"structure": [...], "imports": {...}}}

required

get_dependencies(node_id)

Get direct dependencies of a node.

get_node_metadata(node_id)

Get metadata for a node.

get_statistics()

Get graph statistics for debugging.

build_dependency_graph(parsed_structure)

Build dependency graph from parsed structure.

Parameters:

Name Type Description Default
parsed_structure dict

Output from OSA_TreeSitter.analyze_directory()

required

Returns:

Type Description
DependencyGraph

DependencyGraph instance