Skip to content

Add declarative JSON schema for configuring known behaviors #48

@nrbgt

Description

@nrbgt

Elevator Pitch

Provide a read/write JSON-compatible structure for instantiating and "serializing" the configuration of a forcegraph

Motivation

Having a single, JSON-schema constrained description of a force graph's configuration would simplify a number of use cases.

Additionally, as JSON, it would be theoretically possible to create a mime renderer of a force graph, with this as the metadata. This might be a lower-touch way for other modules to emit a snaphshot of a graph.

Design Ideas

This would allow for something like:

ForceGraph(
    source=src, 
    json={
        "alpha_decay": {},
        "node_labels": {"template": "{{ node.label }}"},
        "node_selection": {"selected": [1,2,3]} 
    }
)

Under the hood these would map to the existing behaviors.

It should then also be possible to extract this back out.

Limitations

It would be challenging to extract de-referenced pointers to the behaviors: this could be somewhat fixed by one of:

  • make behaviors an OrderedDict or InstanceDict
  • adding a name to each of the behaviors, and exposing them as a "squishy" @property or other getter approach
    • this would then need a @T.validate to ensure each has a unique name

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions