Edge¶
- class understand.Edge¶
Bases:
objectGraph plugin edge object
An edge in a graph. Edges are created from
Graphobjects withedge. Graphviz attributes can beset. Usesyncto associateentities,references, or locations with the edge.Edge objects are hashable and compare equal when they refer to the same underlying Graphviz edge.
Methods Summary
Return Graphviz attributes on this edge.
Return the head (destination) node of this directed edge.
Set edge attribute.
Sync edge to a reference, entities, or file location.
Return this edge's current sync data.
Return the tail (source) node of this directed edge.
Methods Documentation
- attributes() dict[str, str]¶
Return Graphviz attributes on this edge.
- Return type:
dict[str, str]
- head() understand.Node¶
Return the head (destination) node of this directed edge.
- Return type:
- set(name, value) None¶
Set edge attribute.
- Parameters:
name (str) – the attribute name
value (str) – the attribute value
- Return type:
None
- Raises:
RuntimeError – on read-only edges from graphs returned by draw (raw graph format)
Refer to Graphviz for available attributes.
- sync(ref) None¶
- sync(arch) None
- sync(ent) None
- sync(ent, comparison_ent) None
- sync(file, line=0, column=0) None
Sync edge to a reference, entities, or file location.
- Parameters:
ref (understand.Ref) – a reference to sync
arch (understand.Arch) – an architecture to sync
ent (understand.Ent) – an entity to sync
comparison_ent (understand.Ent or None) – an entity from the comparison database
file (understand.Ent or str) – a file entity or file path
line (int or None) – optional, a line number
column (int or None) – optional, a column number
- Return type:
None
- Raises:
RuntimeError – on read-only graphs returned by draw (raw graph format)
Line and column numbers are 1-based.
For entity comparison, ent or comparison_ent may be None to show added/removed entities.
- synced_data() object¶
Return this edge’s current sync data.
- Return type:
understand.Ref or understand.Arch or understand.Ent or tuple[understand.Ent | None, understand.Ent | None] or dict[str, str | int | understand.Ent] or list[understand.Ref] or None
- Returns:
sync data currently associated with this object
Locations are returned as dictionaries with a “file” key and optional keys: “entity”, “line”, “column”, “end_line”, and “end_column”. Line and column numbers are 1-based.
Entity comparisons are returned as a tuple with left and right entities. Either entity may be None, usually representing an added/removed entity.
Built-in graphs have more sync types than supported from plugins. Specifically, locations can have end_line and end_column (Control Flow graphs are an example) and edges often sync a list of references.
- tail() understand.Node¶
Return the tail (source) node of this directed edge.
- Return type: