pydistsim.algorithm.node_wrapper.WrapperManager

class WrapperManager(network: NetworkType, nodeAccessType: type[~pydistsim.algorithm.node_wrapper.NodeAccess] = <class 'pydistsim.algorithm.node_wrapper.NodeAccess'>, neighborLabelType: type[~pydistsim.algorithm.node_wrapper.NeighborLabel] = <class 'pydistsim.algorithm.node_wrapper.NeighborLabel'>)[source]

Bases: object

Node Access class

A node’s own view is a proxy for the node that represents the knowledge of the node.

u_own_view and v_own_view are the same object passed as parameters at each algorithm’s action:

@Status.IDLE
def receiving(self, node: NodeAccess, message: Message):
                        

Neighbor Label class

A label for a neighbor is a proxy for the neighbor that represents the knowledge of the neighbor respect to the node.

Alternatively, u_label_for_v and v_label_for_u are the objects that are returned when a node asks for its neighbors in some way:

@Status.IDLE
def receiving(self, node: NodeAccess, message: Message):
    source = message.source  # The node that sent the message
        

    for neighbor in node.neighbors():
            

Methods

__init__

calculate_in_neighbors_dict

calculate_out_neighbors_dict

edges

Returns the edges of the network as a tuple of proxies for the nodes and the labels of the neighbors.

get_node_access

nodes

Returns the proxies for the nodes in the network.

nodes_neighbors

Returns the proxies for the nodes and the labels of it's neighbors.

Attributes

NEIGHBOR_LABEL_TYPE

The class that will be used to wrap the neighbors' labels.

NODE_ACCESS_TYPE

The class that will be used to wrap the nodes' own view.

NEIGHBOR_LABEL_TYPE

The class that will be used to wrap the neighbors’ labels.

alias of type[NeighborLabel]

NODE_ACCESS_TYPE: type[NodeAccess]

The class that will be used to wrap the nodes’ own view.

edges()[source]

Returns the edges of the network as a tuple of proxies for the nodes and the labels of the neighbors. For each edge (u, v), it returns two tuples: - (u_own_view, v_label_for_u) - (v_own_view, u_label_for_v)

nodes()[source]

Returns the proxies for the nodes in the network.

nodes_neighbors()[source]

Returns the proxies for the nodes and the labels of it’s neighbors.