Skip to content

Commit 832abf1

Browse files
authored
Fix graph creation (#1905)
* Add edge weight to all graph creation * Semver
1 parent 25bbae8 commit 832abf1

File tree

13 files changed

+12
-8
lines changed

13 files changed

+12
-8
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "patch",
3+
"description": "Fix graph creation missing edge weights."
4+
}

graphrag/index/operations/finalize_entities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def finalize_entities(
2424
layout_enabled: bool = False,
2525
) -> pd.DataFrame:
2626
"""All the steps to transform final entities."""
27-
graph = create_graph(relationships)
27+
graph = create_graph(relationships, edge_attr=["weight"])
2828
graph_embeddings = None
2929
if embed_config is not None and embed_config.enabled:
3030
graph_embeddings = embed_graph(

graphrag/index/operations/finalize_relationships.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def finalize_relationships(
1919
relationships: pd.DataFrame,
2020
) -> pd.DataFrame:
2121
"""All the steps to transform final relationships."""
22-
graph = create_graph(relationships)
22+
graph = create_graph(relationships, edge_attr=["weight"])
2323
degrees = compute_degree(graph)
2424

2525
final_relationships = relationships.drop_duplicates(subset=["source", "target"])

graphrag/index/workflows/create_communities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def create_communities(
5252
seed: int | None = None,
5353
) -> pd.DataFrame:
5454
"""All the steps to transform final communities."""
55-
graph = create_graph(relationships)
55+
graph = create_graph(relationships, edge_attr=["weight"])
5656

5757
clusters = cluster_graph(
5858
graph,
3.56 KB
Binary file not shown.
46.6 KB
Binary file not shown.
-4.55 KB
Binary file not shown.

tests/verbs/data/documents.parquet

517 Bytes
Binary file not shown.

tests/verbs/data/entities.parquet

10.9 KB
Binary file not shown.
10.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)