pydistsim.algorithm.node_wrapper.NodeAccess
- class NodeAccess(node: Node, manager: WrapperManager, **configs)[source]
Bases:
_NodeWrapperClass used to control the access to a node’s attributes.
For full node access, use the
unbox()method. Be aware that such access may break the knowledge restrictions of the algorithm.Methods
__init__Get the in-neighbors of the node.
Get the out-neighbors of the node.
Alias for out_neighbors.
unboxAttributes
Attributes that can be 'read' from the node base object.
Attributes that can be 'read' or 'written' to the node base object.
clockGet the id of the node.
memorystatus- accessible_get = ('status', 'memory', 'clock')
Attributes that can be ‘read’ from the node base object.
- accessible_set = ('status', 'memory')
Attributes that can be ‘read’ or ‘written’ to the node base object.
- property id
Get the id of the node. If the node does not have an id in memory, a random id will be generated. It is not guaranteed that the id will be unique among all nodes in the network.
Since the id is a read-only attribute, it is cached to avoid generating a new id every time it is accessed.
- in_neighbors() set[NeighborLabel][source]
Get the in-neighbors of the node. If the network is not directed, the in-neighbors are the same as the out-neighbors.
Keep in mind that neighbor.id is only a label for the neighbor, it’s local to the node and it’s only guaranteed to be unique among the neighbors of the node.
- Returns:
The in-neighbors of the node.
- Return type:
set[NeighborAccess]
- neighbors() set[NeighborLabel][source]
Get the out-neighbors of the node.
Keep in mind that neighbor.id is only a label for the neighbor, it’s local to the node and it’s only guaranteed to be unique among the neighbors of the node.
- Returns:
The out-neighbors of the node.
- Return type:
set[NeighborAccess]
- out_neighbors() set[NeighborLabel]
Alias for out_neighbors.