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 also paminco.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. If True, lower bounds are set to 0 and False to -inf. Missing upper bounds are set to inf.

demand_modestr, default=”linear”

How to interpret demand_data, see also Network.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

Network.from_xml(file[, return_dict])

Read network from XML.

Network.from_npz(data[, prefix])

Construct object from .npz file.

Specifying demand and cost

Network.set_demand([data, is_label, ...])

Set demand of network.

Network.set_cost(edge_cost[, cost_type])

Set edge costs.

Network.integrate_cost(*args, **kw)

Integrate edge costs.

Network.differentiate_cost(*args, **kw)

differentiate edge costs.

Math

Network.adjacency_matrix(*args, **kw)

Alias for csgraph().

Network.csgraph(*args, **kw)

Get the compressed sparse graph, shape (n, n).

Network.incidence_matrix(*args, **kwargs)

Alias for Gamma().

Network.Gamma(*args, **kwargs)

Return the incidence matrix Gamma of the network.

Network.gamma_times(x[, node, return_as])

Calculate Gamma @ x.

Network.times_gamma(x[, edge, return_as])

Calculate x @ Gamma.

Network.laplacian([weight, reduced, return_as])

Get the (weighted) Laplacian matrix L.

Network.L([weight, flow, reduced, return_as])

Get weighted Laplacian.

Network.Lstar([weight, flow, reduced, ...])

Pseudo-inverse of weighted Laplacian.

Network.Lstar_update(*args, **kwargs)

Update pseudo-inverse of weighted Laplacian.

Network.potential(flow[, fixed_vertex])

Calculate potential of a flow.

Path and Connectedness

Network.shortest_path([weight, s, ...])

Compute shortest path wrt.

Network.flow_on_shortest(demand_triples[, ...])

Find flow on shortest path.

Network.connected_components([edges, ...])

Extract connected components from network.

Network.is_connected([edges])

Check whether edges are connected.

Network.support_of(flow)

Get the support of the flow.

Cleaning

Network.delete_edges(edges[, update_shared])

Delete some edges from network.

Network.delete_nodes(nodes[, update_shared, ...])

Delete some nodes from network.

Network.clean([remove_zones, ...])

Clean network.

Attributes

Network.cost

Cost associated with network.

Network.demand

Demand associated with network.

Network.shared

Shared object for network objects.

Network.edges

Network edges.

Network.flow_direction

The direction of flow on the edges.

Network.is_directed

Whether the network's edges are directed.

Network.is_single_commodity

Whether network demand consists of single commodity only.

Network.is_multi_commodity

Whether network demand consists of more than one commodity.

Network.nodes

Network nodes.

Network.n

Get number of nodes in network.

Network.m

Get number of edges in network.

Network.k

Get the number of commodities in network.

Network.size

Get number of nodes, edges and commodities.

Network.dtype_int

Get int data type, used for node ids in network.

Network.dtype_float

Get float dtype for network.