Module grscheller.datastructures.nodes.sl
Singularly link nodes for graph-like data structures.
Classes
class SL_Node (data: _T, next: Optional[SL_Node[_T]])
-
Class for singularly link nodes for graph-like data structures.
- this type of node always contain data, even if that data is None
- more than one node can point to the same node forming bush like graphs
- circular graphs are possible
Expand source code
class SL_Node(Generic[_T]): """Class for singularly link nodes for graph-like data structures. * this type of node always contain data, even if that data is None * more than one node can point to the same node forming bush like graphs * circular graphs are possible """ __slots__ = '_data', '_next' def __init__(self, data: _T, next: Optional[SL_Node[_T]]): self._data = data self._next = next def __bool__(self) -> bool: """Singularly linked nodes always contain data. * always returns true * this type of node always contain data, even if that data is None """ return True
Ancestors
- typing.Generic