mcx icon indicating copy to clipboard operation
mcx copied to clipboard

Simplify the access to the graph's nodes

Open rlouf opened this issue 5 years ago • 0 comments

NetworkX's default is to separate the name of a node from the data attached to it; accessing a node by name G.nodes["n"] returns a dictionary with the data, here {"contents": Union[Var, Argument, RandVar, Transformation]}. As a result, the code is full of ["contents"] dictionary access calls, which is aesthetically unpleasant and unintuitive.

I think this behaviour can be overridden by subclassing the NodeView class in mcx.core.graphand overriding the graphs' nodes property.

This would greatly improve the code readability.

rlouf avatar Feb 17 '20 13:02 rlouf