Runic.Workflow.Serializers.Cytoscape (Runic v0.1.0-alpha.7)

Copy Markdown View Source

Serializes Runic Workflows to Cytoscape.js JSON element format.

Output is a list of node and edge elements compatible with Cytoscape.js.

Examples

# Get Cytoscape elements
elements = Runic.Workflow.Serializers.Cytoscape.serialize(workflow)

# Use with Kino.Cytoscape in LiveBook
Kino.Cytoscape.new(elements)

Element Format

Each element follows Cytoscape.js notation:

%{
  data: %{
    id: "n123",
    name: "step_name",
    kind: "step",
    parent: "nParentHash",  # for compound nodes
    background_color: "#2d3748",
    shape: "rectangle"
  }
}

See: https://js.cytoscape.org/#notation/elements-json