At the moment, the elements, styles and layouts are specified using dictionaries. In fact, the syntax is closer to CSS and JS than Pythonic (although dictionaries are inherently pythonic, an object-oriented approach would be intuitive for long-time python users). I still believe dictionary declaration should stay for those who come from Cytoscape.js background, or those who are familiar with CSS selectors.
In fact, the learning curve for dictionary declaration is higher, but it is faster to write and less verbose, as well as being JSON-compatible (in other words, it's easier to import/export graphs from cytoscape.js).
Recommendations
Add object declaration for:
Elements: Node and Edge objects, with flat declaration (remove data parameter).
Styles: Style object with well-documented selectors. Instead of giving a value for a selector key, we would replace it with name and type parameters, respectively the name we are trying to match and the type of matching method (could be by group, by class, by ID, or by a specific entry of data dictionary.
Layout: Layout objects such as Circle, Grid, Concentric, etc.
Links
Cytoscape.js section on selectors for stylesheet: here
Description
At the moment, the elements, styles and layouts are specified using dictionaries. In fact, the syntax is closer to CSS and JS than Pythonic (although dictionaries are inherently pythonic, an object-oriented approach would be intuitive for long-time python users). I still believe dictionary declaration should stay for those who come from Cytoscape.js background, or those who are familiar with CSS selectors.
In fact, the learning curve for dictionary declaration is higher, but it is faster to write and less verbose, as well as being JSON-compatible (in other words, it's easier to import/export graphs from cytoscape.js).
Recommendations
Add object declaration for:
Node
andEdge
objects, with flat declaration (remove data parameter).Style
object with well-documented selectors. Instead of giving a value for aselector
key, we would replace it withname
andtype
parameters, respectively the name we are trying to match and the type of matching method (could be by group, by class, by ID, or by a specific entry ofdata
dictionary.Circle
,Grid
,Concentric
, etc.Links