topos.graphs.pdg.object

Academic Program Dependence Graph (Ferrante/Ottenstein style).

An intra-procedural Program Dependence Graph composes two edge families over the procedure’s statement nodes:

Data Dependence Graph (DDG):
u -DDG-> v iff u defines a variable later read by v

(no intervening redefinition).

Control Dependence Graph (CDG):
u -CDG-> v iff v executes only when u takes a particular

branch (computed from the CFG post-dominator tree).

The fused graph is what slicing, taint, and program-aware diff use. We expose it through the Representation protocol so the rest of Topos can treat it uniformly. This v1 PDG is intentionally not a generator source for the lattice (it has no Φ of its own); it is consumed by the CPG builder. Its dimension is therefore set to a neutral "composable" value so the dispatcher ignores it when there are no dedicated PDG metrics — but the metrics it emits are still surfaced in ClassificationResult.raw_metrics for diagnostics.

class topos.graphs.pdg.object.DependenceKind(*values)[source]

Bases: StrEnum

DATA = 'data'
CONTROL = 'control'
class topos.graphs.pdg.object.DependenceEdge(source, target, kind, var='')[source]

Bases: object

A typed dependence edge between two UAST nodes by stable id.

source
target
kind
var = ''
class topos.graphs.pdg.object.ProgramDependenceGraph(statements=<factory>, edges=<factory>, cfg=None)[source]

Bases: object

Intra-procedural Program Dependence Graph.

statements

All UAST statement nodes contributing to dependence.

Type:

list[topos.graphs.uast.models.UASTNode]

edges

Typed dependence edges (DATA / CONTROL).

Type:

list[topos.graphs.pdg.object.DependenceEdge]

cfg

The CFG from which control dependence was derived.

Type:

topos.graphs.cfg.object.ControlFlowGraph | None

statements
edges
cfg = None
property name
property dimension
classmethod from_uast(uast_root)[source]

Construct DDG ∪ CDG using a freshly-built CFG.

metrics()[source]