balance#
- balance(graph, name=..., direction=...)#
Sums the weights of edges in the graph based on the specified direction.
This function computes the sum of edge weights based on the direction provided, and can be executed in parallel using a given number of threads.
- Parameters:
graph (GraphView) – The graph view on which the operation is to be performed.
name (str) – The name of the edge property used as the weight. Defaults to “weight”.
direction (Direction) – Specifies the direction of the edges to be considered for summation. Defaults to “both”. * “out”: Only consider outgoing edges. * “in”: Only consider incoming edges. * “both”: Consider both outgoing and incoming edges. This is the default.
- Returns:
Mapping of nodes to the computed sum of their associated edge weights.
- Return type: