pydistsim.network.rangenetwork.UdgRangeType

class UdgRangeType(environment: Environment)[source]

Bases: RangeType

Unit disc graph range type.

This class represents the Unit Disc Graph (UDG) channel type. It determines if two nodes are within communication range based on their positions and communication range.

Parameters:

environment (Environment) – The environment in which the channel operates.

Methods

__init__

in_comm_range

Check if two nodes are within communication range.

in_comm_range(network: RangeNetworkType, node1: Node, node2: Node)[source]

Check if two nodes are within communication range.

Two nodes are in communication range if they can see each other and are positioned so that their distance is smaller than the communication range.

Parameters:
  • network (RangeNetworkType) – The network in which the nodes are connected.

  • node1 (Node) – The first node.

  • node2 (Node) – The second node.

Returns:

True if the nodes are within communication range, False otherwise.

Return type:

bool