fault_mesh.utilities.graph

Submodule that uses networkx to find connections between segments in a fault map

Functions:
  • to_graph: Converts a list of node lists into a graph

  • connected_nodes: Finds all connected components in a graph created from node lists

  • suggest_combined_name: Suggests a combined name for a set of connected nodes based on their names

Functions

to_graph(node_list)

Answer from https://stackoverflow.com/a/4843408

connected_nodes(node_list)

Find all connected components in a graph created from node lists.

suggest_combined_name(connected_node_set)

Suggest a combined name for a set of connected nodes.

Module Contents

fault_mesh.utilities.graph.to_graph(node_list)

Answer from https://stackoverflow.com/a/4843408 :param node_list: :return:

Parameters:

node_list (List[List[str]])

fault_mesh.utilities.graph.connected_nodes(node_list)

Find all connected components in a graph created from node lists.

Parameters:

node_list (List[List[str]]) – Lists of nodes where each list represents a path or chain of connected nodes

Returns:

List of sets, where each set contains nodes that are connected to each other

Return type:

list[set]

fault_mesh.utilities.graph.suggest_combined_name(connected_node_set)

Suggest a combined name for a set of connected nodes.

This function analyzes a set of connected node names and attempts to find a meaningful combined name based on common elements or patterns in the names.

Parameters:

connected_node_set (list) – A set of node names that are connected in a graph

Returns:

A suggested name for the combined nodes

Return type:

str