Graph
Defines the graph schemas for graph-based implementations.
References
NONE
Edge
Bases: BaseModel
Represents a directed relationship between two nodes in a graph.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
A unique identifier for the edge. Defaults to a random UUID. |
type |
str
|
The type of the edge/relationship. Defaults to "Edge". |
source_id |
str
|
The ID of the source node. |
target_id |
str
|
The ID of the target node. |
metadata |
dict[str, Any]
|
Additional metadata associated with the edge. Defaults to an empty dictionary. |
Graph
Bases: BaseModel
Represents a complete graph structure with nodes and edges.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
A unique identifier for the graph. Defaults to a random UUID. |
nodes |
list[Node]
|
A list of nodes in the graph. Defaults to an empty list. |
edges |
list[Edge]
|
A list of edges in the graph. Defaults to an empty list. |
metadata |
dict[str, Any]
|
Additional metadata about the graph. Defaults to an empty dictionary. |
Node
Bases: BaseModel
Represents a node in a graph with associated metadata.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
A unique identifier for the node. Defaults to a random UUID. |
type |
str
|
The type or label of the node. Defaults to "Node". |
metadata |
dict[str, Any]
|
Additional metadata associated with the node. Defaults to an empty dictionary. |