Make Edge objects is confusing as xyz coordinates or int keys can be stored in their self.u and self.v attributes. A solution to this would be like what is happening with the Node class, where there is self.xyz and self.key attributes in the constructor (both initialized to None at runtime). When Node.from_point is invoked, node.xyz is repointed to the supplied point, and node.key stays dormant. The converse is true when a node is instantiated from a key (which should be the de-facto way).
The trick comes when adding an Edge to a Diagram, where the latter should handle the addition adequately upon encountering an edge with u, v keys only, or xyz coordinates only, or a combination of the two.
Feature Request
We need to clean up how
Edge
objects are created.Details
Make
Edge
objects is confusing asxyz
coordinates orint
keys can be stored in theirself.u
andself.v
attributes. A solution to this would be like what is happening with theNode
class, where there isself.xyz
andself.key
attributes in the constructor (both initialized toNone
at runtime). WhenNode.from_point
is invoked,node.xyz
is repointed to the supplied point, andnode.key
stays dormant. The converse is true when a node is instantiated from a key (which should be the de-facto way).The trick comes when adding an
Edge
to aDiagram
, where the latter should handle the addition adequately upon encountering an edge withu, v
keys only, orxyz
coordinates only, or a combination of the two.