How to Set Up a NetworkΒΆ
Therefore, the network does not hold much data itself but rather passes requests to the subcompontent
that holds the data. For example, if an algorithm sends a request to the network about
the cost of a flow \(\mathbf{x}\): network.C(x)
, the network passes this request to its cost
subcomponent and returns (a modified) value network.cost(x).sum()
. The main network elements can
be accessed via
network.shared
,
network.nodes
,
network.edges
,
network.cost
and
network.demand
.
We developed this architecture to achieve modularization and separate of concerns while allowing for
complex cost and demand functions. Note that all network components need access to certain network attributes
such as the number of vertices and links \(n\) and \(m\), as well as the the mappings of node labels
to internal node indices that specify the behaviour of graph representations and demand vectors. Therefore
all network elements have a reference
to the Shared
network object that in
turn wraps nodes and edges.
For further details about how to set up a graph (directed or undirected) or specify demand and costs, see: