Skip to content

Edges

The single relationship concept. Every dependency the model holds is an edge from one entity to another, of one kind out of a closed vocabulary of eleven, grouped here in four families by what they connect.

An edge connects two entities and is stored once, outgoing. Its 11 kinds, in 4 families by what they connect, each with its ends and the attributes it adds; its 4 provenance values, a dashed one an inference.Codegraph MetamodelEdgesMODULARITYTYPESBEHAVIORREFERENCESPROVENANCE0..110..10..10..1from 1to 111Edgeedge: EdgeKindfrom, to: EntityIdprovenance: Provenanceanchor: SourceAnchorcandidates?: EntityId[]sourceFile?: stringEntityfrom ≠ to, each known or a stubstored once: outgoing onlyLanguage Profilelicenses, per language, the edgekinds its extractor emitsSourceAnchorfile and span: where it is writtenimportModule → ModulefileIncludeCodeFile → CodeFileinheritanceType → TypeinterfaceImplementationType → interface, trait, protocolembeddingType → TypetraitUsageType → trait, mixin moduleinvocationInvocable → Invocablecandidates?: EntityId[]accessInvocable → StructuralisRead, isWrite: booleanthrowsInvocable → exception typereferenceEntity → TypeannotationUseEntity → annotation typearguments: NamedArgument[]declaredwritten in the sourcederivedcomputed by analysisdynamic-candidateunresolved dispatch: a guessgeneratedmacro or annotation expansionimport: the first-class layer,comparable across languagesfact: the source says soinference: every rendering dashes it
Select a box to jump to its section. Open the diagram alone (SVG)

The diagram is a map of this page: an edge has exactly one kind, so at most one of a family’s, and exactly one provenance — a dashed one is an inference. The red dot marks import, the first-class layer.

Attributes

Every edge, regardless of kind, carries:

AttributeTypeRequiredMeaning
edgeEdgeKindyesdiscriminant, see Edge kinds
fromEntityIdyessource
toEntityIdyesprimary target (best candidate if uncertain)
provenanceProvenanceyeshow we know
anchorSourceAnchoryeswhere observed
candidatesEntityId[]nopossible targets when dispatch is uncertain; non-empty iff resolution was ambiguous
sourceFilestringnodisambiguates which declaration site produced the edge (C# partial classes, TS declaration merging)

Relations: edges connect entities; are licensed per language profile (a profile lists which edge kinds its extractor can emit); carry a SourceAnchor and a Provenance.

Rules

  • Outgoing only, stored once. All inverse views — callers of X, subtypes of Y, importers of M, and children (the inverse of parent) — are derived in memory, never serialized. Only parent is a stored fact.
  • Closure: from and to must resolve to a known entity or a stub — a tested property of every model.
  • No self-reference: from ≠ to.

Edge kinds

Four families, by what an edge connects. Extra attributes are the keys a kind adds to the ones every edge carries.

Modularity

KindFrom → ToExtra attributesNotes
importModule → ModuleFirst-class layer: the only relation reliable ≈100% across all languages, hence the granularity for cross-language comparison. Rust has two levels (mod, crate)
fileIncludeCodeFile → CodeFilePHP include/require — the only file-to-file dependency in the metamodel

Types

KindFrom → ToExtra attributesNotes
inheritanceType → TypeN edges for multiple inheritance (Python); optional MRO order left to profile notes
interfaceImplementationType → Type (interface/trait/protocol)declared (Java implements) or derived (Go, TS structural) depending on language. For Rust/Clojure the anchor is the reified impl block
embeddingType → TypeGo struct { Base } — neither inheritance nor attribute (method promotion); dedicated relation
traitUsageType → Trait (PHP), Type → mixin module (Ruby)PHP use TraitX;, Ruby include/extend/prepend — kept as a usage edge, never flattened into the class

Behavior

KindFrom → ToExtra attributesNotes
invocationInvocable → Invocablecandidatesuncertain dispatch → provenance: dynamic-candidate + candidates list
accessInvocable → StructuralisRead: bool, isWrite: boolfield/variable reads and writes; a compound assignment sets both
throwsInvocable → Type (exception)a written throw statement whose static exception type resolved; the anchor is the throw SITE. A declared propagation clause (Java throws E) is a plain reference, not this

References

KindFrom → ToExtra attributesNotes
referenceEntity → Typetype usage that is none of the above (declarations, generics, casts)
annotationUseEntity → Type (annotation)arguments: NamedArgument[]a written annotation on any entity, with its arguments. The dedicated kind carries the values and lets a consumer select annotation usages without guessing from the target’s kind — which a stub target cannot answer

The closed vocabulary

Eleven names, in the order the header dictionary’s enum declares them:

import · inheritance · interfaceImplementation · invocation · access · reference · embedding · traitUsage · fileInclude · annotationUse · throws

The keys each edge carries on the wire are listed under model.jsonl.

Folded edges

Analyses do not read base edges directly: the analyzer folds them to --level module or --level type first, aggregating every base edge between two folded nodes into one arrow that carries the count, the set of base kinds and the set of provenances. A folded arrow is an inference about a group, not a written fact; what it aggregates is stated in every rendering.

Last updated on