topo_metrics.symbols#

Classes#

VertexSymbol

Vertex Symbol (VS) representation.

CARVS

Cummulative All-Rings Vertex Symbol (CARVS) vector.

Functions#

pad_carvs(→ Sequence[CARVS])

Pad the vectors of a list of CARVS objects to the same length.

pad_carvs_per_atom(...)

Pad the CARVs per atom to the same length.

get_all_topological_distances(→ numpy.ndarray)

Compute the topological distances between all pairs of CARVS objects.

Module Contents#

class topo_metrics.symbols.VertexSymbol[source]#

Bases: NamedTuple

Vertex Symbol (VS) representation.

vector[source]#

The Vertex Symbol vector.

vector_all_rings[source]#

The Vertex Symbol vector considering all rings.

vector: list[list[int]][source]#
vector_all_rings: list[list[int]][source]#
to_str(all_rings: bool = False) str[source]#

Returns the string representation of the VertexSymbol.

If all_rings is True, ring counts are grouped and formatted with multiplicity. Otherwise, only the smallest ring sizes are shown, with multiplicity for repeated values.

Parameters:

all_rings – If True, ring counts are grouped and formatted with multiplicity. Otherwise, only the smallest ring sizes are shown, with multiplicity for repeated values.

Return type:

A string representation of the VertexSymbol.

class topo_metrics.symbols.CARVS[source]#

Bases: NamedTuple

Cummulative All-Rings Vertex Symbol (CARVS) vector.

vector[source]#

The CARVS vector.

spread[source]#

The standard deviation of the CARVS vectors in the network.

is_single_node[source]#

True if the CARVS vector is for a single-node network, False otherwise.

vector: numpy.typing.NDArray[numpy.floating][source]#
spread: float[source]#
is_single_node: bool[source]#
classmethod from_list(carvs_list: Sequence[CARVS]) CARVS[source]#

Construct a CARVS object from a list of CARVS objects, averaging the vectors and spreads.

Parameters:

carvs_list – One or more CARVS objects to be averaged.

Returns:

  • A new CARVS object whose vector is the average of all input vectors,

  • whose spread is the average of all input spreads, and whose

  • ’is_single_node’ is True only if it is True for every entry in

  • carvs_list.

Raises:

ValueError – If carvs_list is empty or if the vectors in carvs_list do not all have the same length.

topo_metrics.symbols.pad_carvs(carvs_list: Sequence[CARVS]) Sequence[CARVS][source]#

Pad the vectors of a list of CARVS objects to the same length.

Parameters:

carvs_list – A list of CARVS objects.

Return type:

A list of CARVS objects with the vectors padded to the same length.

topo_metrics.symbols.pad_carvs_per_atom(all_carvs: list[numpy.typing.NDArray[numpy.int_]]) list[numpy.typing.NDArray[numpy.int_]][source]#

Pad the CARVs per atom to the same length.

Parameters:

all_carvs – List of CARVs per atom.

Return type:

List of padded CARVs per atom.

topo_metrics.symbols.get_all_topological_distances(carvs: list[CARVS]) numpy.ndarray[source]#

Compute the topological distances between all pairs of CARVS objects.

Parameters:

carvs – A list of CARVS objects.

Returns:

  • A square matrix of shape (n_points, n_points) containing the Euclidean

  • distances between all pairs of points.