Graph reduction

After node ranking produces a complete weighted directed graph, the graph reduction module simplifies it by retaining only the most significant edges and their associated nodes. This produces a cleaner visualization that highlights the dominant causal pathways in the process.

The reduction is controlled by specifying the number of top-ranked edges to retain. Nodes that are not connected by any of these top edges are removed from the reduced graph.

Graph reduction is applied across the same scenarios used in node ranking (with dummies suppressed, without dummies, and with dummies visible), producing separate reduced GML files for each.

Note

The following is auto-generated documentation from the graphreduce module source:

Receives a weighted directed graph in GML format and deletes all edges that connects nodes that are connected via some other path. Only the longest paths are retained.

The graph should be available in the “graphs” directory in the case data folder. A reduced graph will have the same title as the original file with the suffix “_simplified”.

A <casename>_graphreduce.json configuration file needs to be available in the case directory root.

class faultmap.graphreduce.GraphReduceData(mode, case)[source]

Creates a data object from file and or function definitions for use in graph reduce method.

scenariodata(scenario)[source]

Retrieves data particular to each scenario for the case being investigated.

faultmap.graphreduce.compute_edge_threshold(graph, percentile)[source]

Calculates the threshold that should be used to delete edges from the original graph based on determined templates.

faultmap.graphreduce.delete_lowval_edges(graph, weight_threshold, remove_self_loops=True)[source]

Deletes all edges with weight below the threshold value. Also deletes all self-looping edges.

faultmap.graphreduce.decompose(input_, output_)[source]

Decomposes (flattens) a list of lists into a simple list.

faultmap.graphreduce.delete_loworder_edges(graph, max_depth, weight_discretion)[source]

Returns a simplified graph with higher order connections eliminated. All self-loops are also deleted.

The level up to which the search for higher order connections should be completed is indicated by the ‘max_depth’ parameter. A value of 1 means that children of children will be investigated, while a value of 2 means that children of children of children will be included in the search, and so on. If depth is set to “full”, then the search is completed until no more children is found.

If the ‘weight_discretion’ boolean is True, a higher order connection between a source node and a child will not be eliminated if this connection weight is higher than the weight of the connection between the last higher-order child to the destination node under question.