endpoint#
Functions
|
Convert various arc-like inputs into a frozenset of two Endpoints. |
|
Return an Endpoint for an endpoint-like input. |
Classes
|
Endpoint at a given node and position, with optional attributes. |
|
Oriented incoming endpoint. |
|
Oriented outgoing 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]
- 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
- class IngoingEndpoint(node, position, **attr)#
Bases:
Endpoint
Oriented incoming endpoint.
- Parameters:
node (Hashable)
position (int)
attr (dict[str, Any])
- static reverse_type()#
Return the opposite endpoint type.
- Returns:
type[OutgoingEndpoint] – The outgoing endpoint class.
- Return type:
type[OutgoingEndpoint]
- static is_oriented()#
Return whether the endpoint type is oriented.
- Returns:
bool – Always
True
.- Return type:
bool
- class OutgoingEndpoint(node, position, **attr)#
Bases:
Endpoint
Oriented outgoing endpoint.
- Parameters:
node (Hashable)
position (int)
attr (dict[str, Any])
- static reverse_type()#
Return the opposite endpoint type.
- Returns:
type[IngoingEndpoint] – The ingoing endpoint class.
- Return type:
type[IngoingEndpoint]
- static is_oriented()#
Return whether the endpoint type is oriented.
- Returns:
bool – Always
True
.- Return type:
bool