From 07d38f3c22ab7d89299db4da24104b34572836c9 Mon Sep 17 00:00:00 2001 From: Eric Koch Date: Mon, 30 Sep 2024 10:15:13 -0400 Subject: [PATCH] Raise error with more informative message for these outliers --- fil_finder/length.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fil_finder/length.py b/fil_finder/length.py index f6c729c..05d9b0c 100644 --- a/fil_finder/length.py +++ b/fil_finder/length.py @@ -443,6 +443,10 @@ def longest_path(edge_list, nodes, verbose=False, node_extrema.append((j[0], i)) values.append(j[1]) + if len(values) == 0: + raise ValueError("Unable to find maximum path. This is likely a bug. Please" + " report to https://github.com/e-koch/FilFinder.") + max_path_length = max(values) start, finish = node_extrema[values.index(max_path_length)] extremum.append([start, finish]) @@ -829,7 +833,7 @@ def get_weight(pat): return long_path, long_path_length - + def merge_nodes(node, G): ''' Combine a node into its neighbors.