Stay updated — Join the build list for tutorials and AI insights. No spam.

Edge Types

Reference for Graphify edge types — imports_from, calls, contains, references reads, writes.

Edge Types

Reference for all relationship types (edges) in the Graphify knowledge graph.

📊 Edge Type Summary

Edge TypeDirectionDescriptionCode Example
imports_fromA → BModule A imports module Bimport yaml
callsA → BFunction A calls function Bmain() → parse_args()
containsA → BFile/module A contains symbol Bfile.py → mergeParams()
referencesA → BSymbol A references symbol BmergeParams() → deepMerge()
readsA → BCode A reads file Bscript → config.yaml
writesA → BCode A writes file Bscript → output.yaml

🔍 Detailed Edge Types

imports_from

Meaning: Module/file imports another module.

Source: Import statements in code.

Examples:

1import yaml           # file.py --imports_from--> yaml
2from pathlib import Path  # file.py --imports_from--> pathlib
3import scripts.dictionary.merge_params  # file.py --imports_from--> merge_params

In Graph:

scripts/dictionary/yt-to-content-v2.py
  --imports_from [context=import]--> argparse
  --imports_from [context=import]--> yaml
  --imports_from [context=import]--> scripts.dictionary.merge_params

Query:

1graphify query "what does scripts/dictionary/yt-to-content-v2.py import?"

calls

Meaning: Function/method calls another function/method.

Source: Function call expressions in code.

Examples:

1def main():
2    parse_args()      # main --calls--> parse_args
3    mergeParams()     # main --calls--> mergeParams
4
5def mergeParams():
6    deepMerge()       # mergeParams --calls--> deepMerge
7    readYaml()        # mergeParams --calls--> readYaml

In Graph:

main() --calls [context=call]--> parse_args()
main() --calls [context=call]--> mergeParams()
mergeParams() --calls [context=call]--> deepMerge()

Query:

1graphify query "what functions does main() call?"
2graphify path main mergeParams

contains

Meaning: File or module contains a symbol (function, class, variable).

Source: Symbol definitions in files.

Examples:

1# file.py contains:
2def mergeParams(): ...     # file.py --contains--> mergeParams
3class Config: ...          # file.py --contains--> Config
4ARGS = []                  # file.py --contains--> ARGS

In Graph:

scripts/dictionary/yt-to-content-v2.py
  --contains--> main()
  --contains--> parse_args()
  --contains--> mergeParams()
  --contains--> ARGS
  --contains--> CONFIG_DIR

Query:

1graphify query "what functions are in scripts/dictionary/yt-to-content-v2.py?"
2graphify explain scripts/dictionary/yt-to-content-v2.py

references

Meaning: Symbol references (uses, mentions) another symbol without calling it.

Source: Variable references, attribute access, type annotations, docstrings.

Examples:

1# mergeParams references deepMerge (calls it)
2# mergeParams references readYaml (calls it)
3# mergeParams references ARGS (uses variable)
4# Config references ARGS (type annotation)

Distinction from calls:

  • calls = explicit function call func()
  • references = any other reference (variable use, attribute, type hint)

In Graph:

mergeParams() --references--> deepMerge
mergeParams() --references--> ARGS
Config --references--> ARGS

Query:

1graphify query "what symbols does mergeParams reference?"

reads

Meaning: Code reads a file (config, data, template, transcript).

Source: File I/O operations: open(), read(), yaml.safe_load(), etc.

Examples:

1with open("tasks/content.yaml") as f:     # script --reads--> tasks/content.yaml
2yaml.safe_load(f)                          # script --reads--> tasks/content.yaml
3transcript = fetch_transcript(url)         # script --reads--> transcript.txt

In Graph:

scripts/dictionary/yt-to-content-v2.py
  --reads--> tasks/content.yaml
  --reads--> .prompts/youtube/transcripts/...-transcript.txt

Query:

1graphify query "what files does yt-to-content-v2.py read?"

writes

Meaning: Code writes/creates a file.

Source: File output operations: open(..., 'w'), write(), yaml.dump(), etc.

Examples:

1with open("output.yaml", "w") as f:        # script --writes--> output.yaml
2yaml.dump(data, f)                          # script --writes--> output.yaml
3create_folders()                            # script --writes--> directory structure

In Graph:

scripts/dictionary/yt-to-content-v2.py
  --writes--> .prompts/youtube/prompts/...-prompt.md
  --writes--> .prompts/youtube/transcripts/...-transcript.txt
  --writes--> content/courses/.../index.md (via prompt)

Query:

1graphify query "what files does yt-to-content-v2.py write?"

🔄 Edge Type Combinations

Typical Code Flow

tasks/content.yaml
  --contains (task def)--> yt:content
  --references (vars)--> scripts/dictionary/yt-to-content-v2.py
  --reads (by script)--> (script reads task vars)

scripts/dictionary/yt-to-content-v2.py
  --contains--> main, parse_args, mergeParams
  --imports_from--> argparse, yaml, scripts.dictionary.merge_params
  --calls (main)--> parse_args, mergeParams
  --calls (mergeParams)--> deepMerge, readYaml
  --reads--> tasks/content.yaml, transcript.txt
  --writes--> prompt.md, transcript.txt

Querying Edge Types

 1# All imports
 2graphify query "what does file.py import?"
 3
 4# All calls from function
 5graphify query "what does functionName call?"
 6
 7# All contained symbols
 8graphify query "what functions are in file.py?"
 9
10# Files read
11graphify query "what files does file.py read?"
12
13# Files written
14graphify query "what files does file.py write?"
15
16# Full trace
17graphify path file.py target.yaml

🎯 Edge Attributes

Some edges have attributes (shown in [brackets]):

AttributeEdge TypesExample
context=importimports_from--imports_from [context=import]--> yaml
context=callcalls--calls [context=call]--> parse_args()
context=referencereferences--references [context=reference]--> deepMerge

Next Steps