nvflare.app_opt.p2p.types package

Module contents

class Config(network: ~nvflare.app_opt.p2p.types.Network, extra: dict = <factory>)[source]

Bases: object

Represents the configuration for the peer-to-peer algorithm.

The configuration includes the network topology and any extra algorithm-specific parameters. Algorithm-specific parameters in extra can include settings like ‘stepsize’, ‘iterations’, etc.

extra: dict
network: Network
class LocalConfig(neighbors: list[~nvflare.app_opt.p2p.types.Neighbor], extra: dict = <factory>)[source]

Bases: object

Represents the local configuration for a node in the network.

The local configuration includes the node’s neighbors and any extra algorithm-specific parameters. Algorithm-specific parameters in extra can include settings like ‘stepsize’, ‘iterations’, etc.

extra: dict
neighbors: list[Neighbor]
class Neighbor(id: int | str, weight: float | None = None)[source]

Bases: object

Represents a neighbor in the network.

Each neighbor is characterized by an identifier and an optional weight, which can be used in algorithms that require weighted interactions between nodes.

id: int | str
weight: float | None = None
class Network(nodes: list[~nvflare.app_opt.p2p.types.Node] = <factory>)[source]

Bases: object

Represents a network consisting of multiple nodes.

The network defines the topology over which the peer-to-peer algorithm operates. During initialization, any node specified as a dictionary is converted into a Node instance.

nodes: list[Node]
class Node(id: int | str | None = None, neighbors: list[~nvflare.app_opt.p2p.types.Neighbor] = <factory>)[source]

Bases: object

Represents a node in the network.

A node contains an identifier and a list of its neighbors. During initialization, any neighbor specified as a dictionary is converted into a Neighbor instance to ensure consistent data structures.

id: int | str | None = None
neighbors: list[Neighbor]