netflow.checks#

Functions

check_connected_graph(G)

Raises an AssertionError if the graph is not connected

check_distance_matrix(A)

Raises AssertionError if the distance matrix is not non-negative and symmetric.

check_edges_in_graph(G, edges)

Raises AssertionError if not all edges are in the graph.

check_graph_no_self_loops(G)

Raises an AssertionError if the graph has self-loops

check_graph_weights(G, component, weight[, tol])

Raises an AssertionError if there are weights below the tolerance

check_matrix_no_nan(A)

Raises AssertionError if the matrix has any missing values.

check_matrix_nonnegative(A)

Raises AssertionError if the matrix has negative values.

check_symmetric(A)

Raises AssertionError if the matrix is not symmetric.

netflow.checks.check_connected_graph(G)[source]#

Raises an AssertionError if the graph is not connected

netflow.checks.check_distance_matrix(A)[source]#

Raises AssertionError if the distance matrix is not non-negative and symmetric.

Note: This does not require the diagonal to be zeros.

netflow.checks.check_edges_in_graph(G, edges)[source]#

Raises AssertionError if not all edges are in the graph.

netflow.checks.check_graph_no_self_loops(G)[source]#

Raises an AssertionError if the graph has self-loops

netflow.checks.check_graph_weights(G, component, weight, tol=1e-06)[source]#

Raises an AssertionError if there are weights below the tolerance

Parameters:
  • G (networkx graph) – The graph.

  • component ({'node', 'edge'}) – Component of graph the weights are attributed to.

  • weight (str) – Graph attribute of the weight.

  • tol (float, default = TOL) – The tolerance to check that no weights are below tol.

netflow.checks.check_matrix_no_nan(A)[source]#

Raises AssertionError if the matrix has any missing values.

netflow.checks.check_matrix_nonnegative(A)[source]#

Raises AssertionError if the matrix has negative values.

netflow.checks.check_symmetric(A)[source]#

Raises AssertionError if the matrix is not symmetric.