Skip to content

Graph Module

Graph Manager

GraphManager(adapter: Any, project: ProjectSummary)

Graph manager for a specific project.

Provides graph operations like adding nodes/edges without requiring project context on each method call.

Parameters:

Name Type Description Default
adapter Any

adapter (FluidizeSDK or LocalAdapter)

required
project ProjectSummary

The project this graph manager is bound to

required

get() -> GraphData

Get the complete graph for this project.

Returns:

Type Description
GraphData

GraphData containing all nodes and edges for this project

add_node(node: GraphNode, sim_global: bool = True) -> NodeManager

Add a new node to this project's graph.

Parameters:

Name Type Description Default
node GraphNode

The node to insert

required
sim_global bool

Whether to use global simulations (placeholder for future)

True

Returns:

Type Description
NodeManager

The added node

update_node_position(node: GraphNode) -> GraphNode

Update a node's position in this project's graph.

Parameters:

Name Type Description Default
node GraphNode

The node with updated position

required

Returns:

Type Description
GraphNode

The updated node

delete_node(node_id: str) -> None

Delete a node from this project's graph.

Parameters:

Name Type Description Default
node_id str

ID of the node to delete

required

add_edge(edge: GraphEdge) -> GraphEdge

Add or update an edge in this project's graph.

Parameters:

Name Type Description Default
edge GraphEdge

The edge to upsert

required

Returns:

Type Description
GraphEdge

The upserted edge

delete_edge(edge_id: str) -> None

Delete an edge from this project's graph.

Parameters:

Name Type Description Default
edge_id str

ID of the edge to delete

required

Graph Processor

GraphProcessor(project: ProjectSummary)

Local filesystem-based graph processor.

Handles all graph operations using the filesystem as the source of truth, compatible with the FastAPI interface but without cloud dependencies.

Initialize the graph processor.

Parameters:

Name Type Description Default
project ProjectSummary

The project to operate on

required

get_graph() -> GraphData

Gets the entire graph for the project from graph.json file.

Returns:

Type Description
GraphData

GraphData containing all nodes and edges

insert_node(node: GraphNode, sim_global: bool = True) -> GraphNode

Inserts a node from the list of simulations or creates a new one.

Parameters:

Name Type Description Default
node GraphNode

The node to insert

required
sim_global bool

Whether to use global simulations

True

Returns:

Type Description
GraphNode

The inserted node

insert_node_from_scratch(GraphNode: GraphNode, nodeProperties: nodeProperties_simulation, nodeMetadata: nodeMetadata_simulation, repo_link: Optional[str] = None) -> GraphNode

Inserts a new node into the graph from scratch, creating all necessary files and directories.

Parameters:

Name Type Description Default
GraphNode GraphNode

The graph node to insert

required
nodeProperties nodeProperties_simulation

Properties configuration for the node

required
nodeMetadata nodeMetadata_simulation

Metadata configuration for the node

required
repo_link Optional[str]

Optional repository URL to clone into the source directory

None

Returns:

Type Description
GraphNode

The inserted GraphNode

update_node_position(node: GraphNode) -> GraphNode

Updates a node's position in the graph.json file.

Parameters:

Name Type Description Default
node GraphNode

The node with updated position

required

Returns:

Type Description
GraphNode

The updated node

delete_node(node_id: str) -> None

Deletes a node from the graph and removes its directory.

Parameters:

Name Type Description Default
node_id str

ID of the node to delete

required

upsert_edge(edge: GraphEdge) -> GraphEdge

Adds or updates an edge in the graph.json file.

Parameters:

Name Type Description Default
edge GraphEdge

The edge to upsert

required

Returns:

Type Description
GraphEdge

The upserted edge

delete_edge(edge_id: str) -> None

Deletes an edge from the graph.json file.

Parameters:

Name Type Description Default
edge_id str

ID of the edge to delete

required

Graph Types

GraphData

Bases: BaseModel

A graph representation of a project in the graph.json file.

Attributes:

Name Type Description
nodes list[GraphNode]

List of nodes.

edges list[GraphEdge]

List of edges.

GraphNode

Bases: BaseModel

A node in the graph.

Attributes:

Name Type Description
id str

Unique node ID.

position Position

Node position.

data graphNodeData

Extra metadata.

type str

Renderer/type key.

GraphEdge

Bases: BaseModel

An edge in the graph.

Attributes:

Name Type Description
id str

Unique edge ID.

source str

Source node ID.

target str

Target node ID.

type str

Renderer/type key.