dpapathanasiou / simple-graph

This is a simple graph database in SQLite, inspired by "SQLite as a document database"
MIT License
1.4k stars 86 forks source link

Feature request: Color properties for visualizations on Edges & Nodes #19

Closed ghost closed 1 year ago

ghost commented 1 year ago

Would it be possible to add color properties for the visualizations of edges & nodes? Graphviz supports it for the python colors: https://graphviz.org/doc/info/colors.html

I'm not sure about the other languages then python but I'm sure I wouldn't be alone to want colors in graphs to ease their use when they become large.

dpapathanasiou commented 1 year ago

Hi @lancilloty

The great thing about the schema is that both the node bodies and the edge properties allow any valid json.

So all you have to do is include a key value pair like "fillcolor": "cyan" in the node bodies, and then the visualizer function (the python implementation has moved here, BTW) should be able to represent that as a node attribute without any further modification.

That's just off the top of my head though, I haven't tried it, and you might need a slight tweak to either the _as_dot_label or _as_dot_node functions to get it to work.

Feel free to file a request there if it doesn't pick it up automatically.