Skip to content

Simplify the access to the graph's nodes #4

@rlouf

Description

@rlouf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-compilerNon user-facing improvementspriority-1Not bug, but high priority issue / PR

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions