Skip to content

edges

Edges

Bases: Serializable

Core object representing edges. Edges are defined by multiple properties - indices (np.ndarray(N, 2)): the edges defined as sources and target indices - distances (np.ndarray(N)): the length of each edge - scalars (np.ndarray(M)): the scalar values for each node (optional) - delta_lat (np.ndarray(M)): the delta LAT values for each node (optional) - masks: boolean masks containing all the filters that were applied to the graph

default_weight = weights_name instance-attribute

distances: np.ndarray property

The masked distances between all edges.

Returns:

Type Description
ndarray

np.ndarray[N]: Array of edge distances.

full_distances = np.array(full_distances, dtype=np.float64) instance-attribute

full_indices = np.array(full_indices, dtype=int) instance-attribute

full_weights: np.ndarray property

The masked weights between all edges.

Returns:

Type Description
ndarray

np.ndarray[N]: Array of edge weights.

full_weights_dict = {weights_name: np.array(full_weights, dtype=np.float64)} instance-attribute

indices: np.ndarray property

Return all masked edge connections. The array contains N sub arrays with two elements. The first element is the index of the source node, the second element is the index of the target node.

Returns:

Type Description
ndarray

np.ndarray[N, 2]: Array of indices of edges.

mask = np.full(self.full_indices.shape[0], True) instance-attribute

masks = {} instance-attribute

sources_ids: np.ndarray property

The masked source_ids between all edges.

Returns:

Type Description
ndarray

np.ndarray[N]: Array of edge source_ids.

targets_ids: np.ndarray property

The masked targets_ids between all edges.

Returns:

Type Description
ndarray

np.ndarray[N]: Array of edge targets_ids.

weights: np.ndarray property

The masked weights between all edges.

Returns:

Type Description
ndarray

np.ndarray[N]: Array of edge weights.

__init__(full_indices, full_distances, full_weights, weights_name='delta_lat')

Parameters:

Name Type Description Default
full_indices np.ndarray(N, 2

the edges defined as sources and target indices

required
full_distances np.ndarray(N

the length of each edge

required
full_weights Nodes

the nodes corresponding with the graph vertices

required

add_mask(name, mask)

Add new boolean mask of specific property.

Parameters:

Name Type Description Default
name str

Name of the field to add.

required
mask boolean ndarray

Boolean mask to add.

required

add_weights(weight_array, name)

get_full_weights(name)

get_weights(name)

remove_mask(name)

Remove a boolean mask by name. A new mask is constructed by taking the bitwise and between all remaining masks

set_default_weights(name)

to_df()