Edges¶
Class Description¶
- class paminco.net.Edges(data, directed_flow: bool = True, map_labels_to_indices=True, map_indices_to_labels=True, dtype_float=None, dtype_int=None, copy: bool = False)[source]¶
Class that contains the edges/links of a network.
- An edges object can be instantiated in several ways:
- Edges(e)
where
e
is an Edges object. Data ine
will be copied if specfied by parametercopy
.- Edges(st)
where
st
is array_like. Parameter st is converted to ndarray and is expected to me of shape (m, 2). Can be node indices or node labels specifying an edge. If labels are given, indices are mapped bymap_labels_to_indices
, given indices are mapped bymap_indices_to_labels
. Edge bounds are determined by the parameterdirected
.- Edges((st, bounds))
where
st
is array_like andbounds
is tuple (lower, upper) specifying bounds used for all edges or array_like of shape (m, 2) marking individual bounds for all edges.- Edges((labels, indices, bounds))
where
labels
,indices
are array_like of shape (m, 2) andbounds
is tuple (lower, upper) specifying bounds used for all edges or array_like of shape (m, 2) containing individual bounds for all edges.
- Parameters
- datandarray, or tuple of ndarray
Edge data.
- directed_flowbool, default=True
Controls default values for
None
in bounds. IfTrue
, lower bounds are set to 0 andFalse
to -inf. Missing upper bounds are set to inf.- map_labels_to_indicesNone, bool, dict, or callable, default=True
Determines mapping of labels to indices if no indices are given. If
None
orFalse
, indices of edges will be set to -9999, denoting invalid edge indices. Ifdict
, labels will be mapped by this dict. IfTrue
, node indices are set to 0, 1, …, n-1. Ifcallable
, use callable with signatureindices = callable(labels)
.- map_indices_to_labelsNone, bool, dict, or callable, default=True
Determines mapping of indices to indices if no labels are given. If
None
orFalse
, indices of edges will be set to ‘invalid’, denoting invalid edge labels. Ifdict
, indices will be mapped by this dict. IfTrue
, node labels are set to node indices as str. Ifcallable
, use callable with signaturelabels = callable(indices)
.- dtype_floatdtype, default=numpy.float_
Datatype for edge bounds.
- dtype_intdtype, default=int
Datatype for edge bounds.
- copybool, default=False
Whether to create a copy of the inputs in data.
- Attributes
- flow_directionsndarray
Ndarray of shape (m, ). A
-1
denotes an edge with lb < 0 and ub <= 0. A0
denotes an edge with lb < 0 and ub > 0. A1
denotes an edge with lb >=0 and ub > 0.
Methods¶
|
Load object from |
|
Construct object from |
|
Get object as DataFrame. |
|
|
|
|
Map edge labels by d. |
|
|
Add edge data to XML Element. |
|
Generate dict to save object with numpy.savez. |
|
Save object into a single file in uncompressed |
Attributes¶
ndarray (m, ) of floats: lower bound. |
|
ndarray (m, ) of floats: upper bound. |
|
ndarray (m, ) of int: source ids. |
|
ndarray (m, ) of int: target ids. |
|
ndarray (m, ) of str: sources labels. |
|
ndarray (m, ) of str: target labels. |
|
dtype of int data. |
|
dtype of float data. |
|