Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add declarative JSON schema for configuring known behaviors #48

Open
nrbgt opened this issue Feb 17, 2023 · 0 comments
Open

Add declarative JSON schema for configuring known behaviors #48

nrbgt opened this issue Feb 17, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@nrbgt
Copy link
Contributor

nrbgt commented Feb 17, 2023

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
@nrbgt nrbgt added the enhancement New feature or request label Feb 17, 2023
@nrbgt nrbgt moved this to Todo in ipyforcegraph Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant