spark.graph_editor.models.graph#

Classes#

SparkNodeViewer

Custom reimplementation of NodeViwer use to solve certain bugs.

SparkNodeGraph

NodeGraphQt object for building/managing Spark models.

Module Contents#

class spark.graph_editor.models.graph.SparkNodeViewer(parent=None, undo_stack=None)[source]#

Bases: NodeGraphQt.widgets.viewer.NodeViewer

Custom reimplementation of NodeViwer use to solve certain bugs.

BUGFIX_on_save[source]#
focusInEvent(event)[source]#
focusOutEvent(event)[source]#
keyPressEvent(event)[source]#

Explicitly ignore Ctrl+S so it propagates to the Main Window.

class spark.graph_editor.models.graph.SparkNodeGraph(parent=None, **kwargs)[source]#

Bases: NodeGraphQt.NodeGraph

NodeGraphQt object for building/managing Spark models.

context_menu_prompt[source]#
broadcast_message[source]#
on_update[source]#
name_exist(name)[source]#
Parameters:

name (str)

Return type:

bool

update_node_name(id, name)[source]#
Parameters:
Return type:

None

create_node(node_type, name=None, selected=True, color=None, text_color=None, pos=None, push_undo=True, select_node=True)[source]#
Parameters:
Return type:

spark.graph_editor.models.nodes.AbstractNode

delete_node(node, push_undo=True)[source]#
Return type:

None

build_raw_graph()[source]#
Return type:

networkx.DiGraph

get_nodes_by_map()[source]#
Return type:

Tuple[List[spark.graph_editor.models.nodes.AbstractNode], List[spark.graph_editor.models.nodes.AbstractNode], List[spark.graph_editor.models.nodes.AbstractNode]]

load_from_model(config)[source]#
Parameters:

config (spark.nn.brain.BrainConfig)

validate_graph()[source]#

Simple graph validation.

Ensures that graph has a single connected component and at least one source and one sink is present in the model.

Return type:

list[str]

build_brain_config(is_partial=True, errors=None)[source]#

Build the model from the graph state.

Parameters:
  • is_partial (bool)

  • errors (list | None)

Return type:

spark.nn.brain.BrainConfig