Shared

Class Description

class paminco.net.Shared(edge_data, node_data=None, dtype_float=<class 'numpy.float64'>, dtype_int=<class 'int'>, **kwargs)[source]

Class that acts as a shared object for a Network.

Consists mainly of nodes and edges object, handles label and index mappings.

Parameters
edge_datatuple of ndarray

Data to construct Edges object.

node_dataarray_like or tuple of ndarray, optional

Data to construct Nodes object.

dtype_floatdtype, default=numpy.float_

Datatype for all float ndarray.

dtype_intdtype, default=int

Datatype for all int ndarray.

See also

Edges
Nodes

Methods

Shared.update()

Update internal node and edge mappings.

Shared.reset_cache([hard])

Shared.delete_edges(edges[, update])

Delete edge(s) from Edges object.

Shared.delete_nodes(nodes[, update, is_label])

Delete node(s) from Nodes object.

Shared.delete_nodes_in_edges(nodes[, ...])

Delete node(s) from Edges object.

Shared.incidence_matrix(*args, **kwargs)

Alias for Shared.Gamma().

Shared.Gamma([return_as, transpose])

Return the incidence matrix Gamma of the network.

Shared.adjacency_matrix(*args, **kw)

Alias for csgraph().

Shared.csgraph([weight, respect_bounds, ...])

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

Shared.get_edge_id(nodes)

Map node indices to edge indices.

Shared.get_node_id(nodes[, vectorize])

Map labels in nodes to node indices.

Shared.get_node_label(nodes[, vectorize])

Map indices in nodes to node labels.

Shared.from_xml(data, **kwargs)

Load object from .xml data.

Shared.make_save_dict([prefix, save_dict])

Generate dict to save object with numpy.savez.

Shared.save_to_numpy(file, **kwargs)

Save object into a single file in uncompressed .npz format.

Shared.from_npz(data[, prefix, kw_edges, ...])

Load Shared from .npz file.

Attributes

edges

Get Edges object.

nodes

Get Nodes object.

Shared.flow_direction

The direction of flow on the edges.

Shared.n

Get number of nodes in network.

Shared.m

Get number of edges in network.

Shared.nodes2edge

Get dict that maps (node_id, node_id) -> edge_id.

Shared.node2id

Get dict that maps node label (str) -> node id (int).

Shared.dtype_int

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

Shared.dtype_float

Get float dtype for network.