Combines duplicate edges by aggregating their weights using a specified function (sum, mean, max, min, or first).
aggregate_duplicate_edges(edges, method = "mean")A deduplicated data frame with the same columns as the input, where each node pair appears only once with its aggregated weight.
Data frame with from, to, and weight columns.
Aggregation method: "sum" (default), "mean",
"max", "min", "first", or a custom function that
takes a numeric vector and returns a single value.
Total weight of all duplicate edges. Useful for frequency counts or when edges represent additive quantities (e.g., number of emails).
Average weight. Useful for averaging multiple measurements or when duplicates represent repeated observations.
Maximum weight. Useful for finding the strongest connection or most recent value.
Minimum weight. Useful for the most conservative estimate or earliest value.
Keep first occurrence. Useful for preserving original order or when duplicates are erroneous.
The output edge list uses canonical node ordering (lower index first for undirected networks), ensuring consistent from/to assignment.
detect_duplicate_edges for identifying duplicates before
aggregation