Skip to content

Commit

Permalink
Fix seed init in clustering (#1156)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlonsoGuevara authored Sep 18, 2024
1 parent 594084f commit 1091079
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20240918223351051336.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Fix seed hardcoded init"
}
5 changes: 4 additions & 1 deletion graphrag/index/verbs/graph/clustering/cluster_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def cluster_graph(

num_total = len(output_df)

# Create a seed for this run (if not provided)
seed = strategy.get("seed", Random().randint(0, 0xFFFFFFFF)) # noqa S311

# Go through each of the rows
graph_level_pairs_column: list[list[tuple[int, str]]] = []
for _, row in progress_iterable(
Expand All @@ -87,7 +90,7 @@ def cluster_graph(
cast(str, row[column]),
cast(Communities, row[community_map_to]),
level,
seed=strategy.get("seed"),
seed=seed,
)
)
)
Expand Down

0 comments on commit 1091079

Please sign in to comment.