mufasa.graph#

Classes#

Graph

The Fusion Graph, binding all nodes reachable from its inputs to outputs together.

Module Contents#

class mufasa.graph.Graph(inputs: list[mufasa.Node], outputs: list[mufasa.Node], *, crs: str | None = None, bbox: mufasa.BoundingBox | None = None, resolution: tuple[float, float] | None = None)#

The Fusion Graph, binding all nodes reachable from its inputs to outputs together.

It is responsible for type compatibility checking and orchestrates the execution of the fusion system via its run() method. It also distributes global configuration – crs, bounding box and map raster resolution – to every node.

Parameters:
  • inputs (list[mufasa.Node])

  • outputs (list[mufasa.Node])

  • crs (str | None)

  • bbox (mufasa.BoundingBox | None)

  • resolution (tuple[float, float] | None)

inputs#
outputs#
crs = None#
bbox_wgs84 = None#
bbox#
resolution = None#
run() → None#
Return type:

None

stop() → None#

Signal all streaming inputs to stop.

Return type:

None

reset() → None#

Reset all nodes to their initial state.

Call between runs to prevent state from one run affecting the next.

Return type:

None

to_config() → dict#

Return the full pipeline as a plain serializable dict.

Return type:

dict

classmethod from_config(config: dict) → Graph#

Reconstruct a Graph from a config dict produced by to_config().

Parameters:

config (dict)

Return type:

Graph

save(path: str) → None#

Serialize the pipeline to a JSON file.

Parameters:

path (str)

Return type:

None

classmethod load(path: str) → Graph#

Load and reconstruct a Graph from a JSON file.

Parameters:

path (str)

Return type:

Graph

summary() → None#

Print a human-readable description of the pipeline’s nodes and connections.

Return type:

None

plot_graph()#

Render the pipeline as an interactive Fusion Graph.

Ports on each node show the data types it accepts (top) and produces (bottom); hovering a node shows its full name and connections, hovering a port its concrete data type.

Returns a FusionGraphSVG, which displays itself in Jupyter notebooks and can be written to an .svg file with save().