Network#

Network#

In this (sub-)package you will find all logic required to load network data from diverse sources (file or web based).

The configuration to be used to load a network is usually an .ini file. This file is later represented as a NetworkConfigData object that can as well be directly initialized via code (network_config_data (sub-)package).

The different sources to generate a network are handled through our own network wrappers (NetworkWrapperProtocol) in the network_wrappers (sub-)package.

General class overview#

The following diagram describes the relations between the most relevant entities of the ra2ce.network (sub-)package.

ra2ce_network_class_diagram.drawio.png

Ra2ce network overview

Network config data#

In this package we contain the representation of a network configuration file, its readers and validators.

  • network_config_data.py contains the main dataclass NetworkConfigData which has the properties representing each of the different INI sections as dataclasses.

  • network_config_data_validator.py contains the logic to validate all properties of a NetworkConfigData.

  • network_config_data.py contains the NetworkConfigDataReader, an *.ini file reader that parses its content into an instance of a NetworkConfigData.

Network wrappers#

In this package we define wrappers for reading a ra2ce network (tuple[MultiGraph, GeoDataFrame]). Each different class defines how a network will be created and cleaned. Network wrappers need to instantiate the NetworkWrapperProtocol.

An instance of the NetworkWrapperProtocol defines the get_network method, which will return the aforementioend ra2ce network.

Any network wrapper can be created with the use of a NetworkConfigData instance. At the same time, if the user does not know which wrapper to use, the NetworkWrapperFactory will resolve this for us.

Future work#

Encapsulate NetworkWrapperProtocol output#

(Issue #373) We expect to encapsulate the output of a NetworkWrapperProtocol into our own Ra2ceNetwork object (or else) so that it is easier to represent and refer to which object do we internally handle as a network.