Network¶
Class Description¶
- class paminco.net.Network(edge_data, node_data=None, cost_data=None, demand_data=None, dtype_float=<class 'float'>, dtype_int=<class 'int'>, update_shared: bool = True, directed=None, demand_mode=None, clean=None, kw_edge=None, kw_demand=None, kw_cost=None)[source]¶
A Network.
- Parameters
- edge_dataedge_data
Data that specifies edges. See also
paminco.net.shared.Edges
.- node_datanode_data, optional
Data that specifies nodes. If None, nodes will be inferred from
edge_data
. See alsopaminco.net.shared.Nodes
- cost_datacost_data, optional
Edge costs. If None, linear cost functions
F_e(x_e) = x_e
are assumed for all edges.- demand_datademand_data, optional
Commodity data to initialize a DemandFunction. See also
Network.set_demand()
.- dtype_floatdtype, default=float
Datatype for float data arrays.
- dtype_intdtype, default=int
Datatype for integer data arrays.
- update_sharedbool, default=True
Whether to update shared data after initialization.
- directed_flowbool, default=True
Controls default values for
None
in edge bounds. IfTrue
, lower bounds are set to 0 andFalse
to -inf. Missing upper bounds are set to inf.- demand_modestr, default=”linear”
How to interpret
demand_data
, see alsoNetwork.set_demand()
.- kw_edgekeyword arguments, optional
Further keyword arguments passed to Edge constructor.
- kw_demandkeyword arguments, optional
Further keyword arguments passed to
Network.set_demand()
.- kw_costkeyword arguments, optional
Further keyword arguments passed to
Network.set_cost()
.
See also
paminco.net.shared.Shared
Nodes, edge initialization.
Network.set_demand
Demand initialization.
Network.set_cost
Cost initialization.
Methods¶
Constructors¶
|
Read network from |
|
Construct object from |
Specifying demand and cost¶
|
Set demand of network. |
|
Set edge costs. |
|
Integrate edge costs. |
|
differentiate edge costs. |
Math¶
|
Alias for |
|
Get the compressed sparse graph, shape (n, n). |
|
Alias for |
|
Return the incidence matrix Gamma of the network. |
|
Calculate Gamma @ x. |
|
Calculate x @ Gamma. |
|
Get the (weighted) Laplacian matrix L. |
|
Get weighted Laplacian. |
|
Pseudo-inverse of weighted Laplacian. |
|
Update pseudo-inverse of weighted Laplacian. |
|
Calculate potential of a flow. |
Path and Connectedness¶
|
Compute shortest path wrt. |
|
Find flow on shortest path. |
|
Extract connected components from network. |
|
Check whether edges are connected. |
|
Get the support of the flow. |
Cleaning¶
|
Delete some edges from network. |
|
Delete some nodes from network. |
|
Clean network. |
Attributes¶
Cost associated with network. |
|
Demand associated with network. |
|
Shared object for network objects. |
|
Network edges. |
|
The direction of flow on the edges. |
|
Whether the network's edges are directed. |
|
Whether network demand consists of single commodity only. |
|
Whether network demand consists of more than one commodity. |
|
Network nodes. |
|
Get number of nodes in network. |
|
Get number of edges in network. |
|
Get the number of commodities in network. |
|
Get number of nodes, edges and commodities. |
|
Get int data type, used for node ids in network. |
|
Get float dtype for network. |