topos.graphs.cpg.builder¶
CPG Builder¶
Construct a CodePropertyGraph from a UAST root by composing the AST, CFG, DDG, and CDG edge families into a single labeled multigraph (Yamaguchi et al., arxiv:1909.03496).
Algorithm¶
AST family: every parent → child link from the UAST.
CFG family: every edge of the ControlFlowGraph, projected from block-level (BB -> BB) onto statement-level (last UAST stmt of source block → first UAST stmt of target block).
DDG family: each
DependenceEdge(kind=DATA)from the academic PDG.CDG family: each
DependenceEdge(kind=CONTROL)from the academic PDG.
- topos.graphs.cpg.builder.build_cpg(uast_root, cfg=None, pdg=None)[source]
Return
(nodes, edges)for the CPG.Reuses pre-built CFG / PDG when supplied; otherwise builds them.