views#

Classes

ArcView(nodes)

View over arcs (pairs of endpoints).

EndpointView(nodes)

View over all endpoints of the diagram.

FaceView(nodes)

View over faces (regions) of a planar diagram.

FilteredNodeView(nodes, node_type)

Node view filtered by node type.

NodeView(nodes)

Mapping/set-like view over the diagram’s nodes.

class NodeView(nodes)#

Bases: Mapping, Set

Mapping/set-like view over the diagram’s nodes.

Keys are node identifiers (hashable), values are Node instances.

Note

This is a view: it reflects the underlying diagram. Avoid mutating the diagram while iterating this view.

Parameters:

nodes (dict[Hashable, Node])

_nodes#

Backing node mapping.

Type:

dict[Hashable, Node]

arcs(node)#

Return the arcs emanating from a node.

Each arc is returned as a pair (adjacent_endpoint, endpoint).

Parameters:

node (Hashable) – Node identifier.

Returns:

list[tuple[Endpoint, Endpoint]] – List of arcs from the node.

Return type:

list[tuple[Endpoint, Endpoint]]

class EndpointView(nodes)#

Bases: NodeView

View over all endpoints of the diagram.

Parameters:

nodes (dict[Hashable, Node])

class FilteredNodeView(nodes, node_type)#

Bases: NodeView

Node view filtered by node type.

Parameters:
  • nodes (dict[Hashable, Node])

  • node_type (type[Node])

class FaceView(nodes)#

Bases: NodeView

View over faces (regions) of a planar diagram.

A face (region, area) is modeled as a sequence of endpoints. Given a face on the plane, its boundary is returned by traversing in CCW fashion, using the target (second) endpoint at each step.

Parameters:

nodes (dict[Hashable, Node])

class ArcView(nodes)#

Bases: NodeView

View over arcs (pairs of endpoints).

Parameters:

nodes (dict[Hashable, Node])