Skip to content

Results are limited to Qoolqit v0.4.0

Product news
You are reading Qoolqit v0.4.0, an older version of this documentation. Go to the latest version (v1.6.0)

qoolqit.graphs.utils

module
qoolqit.graphs.utils

Functions

  • all_node_pairs — Return all pairs of nodes (u, v) where u < v.

  • distances — Return a dictionary of edge distances.

  • radial_distances — Return a dictionary of node distances from the origin.

  • scale_coords — Scale the coordinates by a given value.

  • space_coords — Spaces the coordinates so the minimum distance is equal to a set spacing.

  • random_coords — Generate a random set of node coordinates on a square of side L.

  • random_edge_list — Generates a random set of k edges linkings items from a set of nodes.

  • less_or_equal — Less or approximately equal.

all_node_pairs (nodes: Iterable) → set

Return all pairs of nodes (u, v) where u < v.

Parameters

  • nodes : Iterable — set of node indices.

distances (coords: dict, edge_list: Iterable) → dict

Return a dictionary of edge distances.

Parameters

  • coords : dict — dictionary of node coordinates.

  • edge_list : Iterable — edge list to compute the distances for.

radial_distances (coords: dict) → dict

Return a dictionary of node distances from the origin.

Parameters

  • coords : dict — dictionary of node coordinates.

scale_coords (coords: dict, scaling: float) → dict

Scale the coordinates by a given value.

Parameters

  • coords : dict — dictionary of node coordinates.

  • scaling : float — value to scale by.

space_coords (coords: dict, spacing: float) → dict

Spaces the coordinates so the minimum distance is equal to a set spacing.

Parameters

  • coords : dict — dictionary of node coordinates.

  • spacing : float — value to set as minimum distance.

random_coords (n: int, L: float = 1.0) → list

Generate a random set of node coordinates on a square of side L.

Parameters

  • n : int — number of coordinate pairs to generate.

  • L : float — side of the square.

random_edge_list (nodes: Iterable, k: int) → list

Generates a random set of k edges linkings items from a set of nodes.

less_or_equal (a: float, b: float, rel_tol: float = 0.0, abs_tol: float = ATOL_32) → bool

Less or approximately equal.