Endpoint#
- class Endpoint(node, position, **attr)#
Bases:
object
Endpoint at a given node and position, with optional attributes.
Endpoints are incidences of nodes in a planar diagram. Oriented variants are represented by subclasses
IngoingEndpoint
andOutgoingEndpoint
.- Parameters:
node (Hashable)
position (int)
attr (dict[str, Any])
- node#
Node identifier.
- Type:
Hashable
- position#
Position index at the node (counter-clockwise order).
- Type:
int
- attr#
Arbitrary endpoint attributes (e.g., colors).
- Type:
dict[str, Any]
- __init__(node, position, **attr)#
Construct an endpoint.
- Parameters:
node (Hashable) – Node identifier.
position (int) – Position index at the node.
**attr (Any) – Arbitrary endpoint attributes.
- Return type:
None
Methods
__init__
(node, position, **attr)Construct an endpoint.
get
(key[, _Endpoint__default])Return an attribute value with a default.
Return whether this endpoint type is oriented.
Return the opposite endpoint type.
Attributes
- node: Hashable#
- position: int#
- attr: dict[str, Any]#
- get(key, _Endpoint__default=None)#
Return an attribute value with a default.
- Parameters:
key (str) – Attribute key.
__default – Default value if key is missing.
_Endpoint__default (Any)
- Returns:
Any – Stored value or
__default
.- Return type:
Any
- static reverse_type()#
Return the opposite endpoint type.
- Returns:
type[Endpoint] – For base
Endpoint
, returnsEndpoint
itself.- Return type:
type[Endpoint]
- static is_oriented()#
Return whether this endpoint type is oriented.
- Returns:
bool –
False
for baseEndpoint
.- Return type:
bool