Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20250430001238698062.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Fix graph creation missing edge weights."
}
2 changes: 1 addition & 1 deletion graphrag/index/operations/finalize_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def finalize_entities(
layout_enabled: bool = False,
) -> pd.DataFrame:
"""All the steps to transform final entities."""
graph = create_graph(relationships)
graph = create_graph(relationships, edge_attr=["weight"])
graph_embeddings = None
if embed_config is not None and embed_config.enabled:
graph_embeddings = embed_graph(
Expand Down
2 changes: 1 addition & 1 deletion graphrag/index/operations/finalize_relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def finalize_relationships(
relationships: pd.DataFrame,
) -> pd.DataFrame:
"""All the steps to transform final relationships."""
graph = create_graph(relationships)
graph = create_graph(relationships, edge_attr=["weight"])
degrees = compute_degree(graph)

final_relationships = relationships.drop_duplicates(subset=["source", "target"])
Expand Down
2 changes: 1 addition & 1 deletion graphrag/index/workflows/create_communities.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_communities(
seed: int | None = None,
) -> pd.DataFrame:
"""All the steps to transform final communities."""
graph = create_graph(relationships)
graph = create_graph(relationships, edge_attr=["weight"])

clusters = cluster_graph(
graph,
Expand Down
Binary file modified tests/verbs/data/communities.parquet
Binary file not shown.
Binary file modified tests/verbs/data/community_reports.parquet
Binary file not shown.
Binary file modified tests/verbs/data/covariates.parquet
Binary file not shown.
Binary file modified tests/verbs/data/documents.parquet
Binary file not shown.
Binary file modified tests/verbs/data/entities.parquet
Binary file not shown.
Binary file modified tests/verbs/data/relationships.parquet
Binary file not shown.
Binary file modified tests/verbs/data/text_units.parquet
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/verbs/test_finalize_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ async def test_finalize_graph():
nodes_actual = await load_table_from_storage("entities", context.storage)
edges_actual = await load_table_from_storage("relationships", context.storage)

assert len(nodes_actual) == 251
assert len(edges_actual) == 372
assert len(nodes_actual) == 291
assert len(edges_actual) == 452

# x and y will be zero with the default configuration, because we do not embed/umap
assert nodes_actual["x"].sum() == 0
Expand All @@ -54,8 +54,8 @@ async def test_finalize_graph_umap():
nodes_actual = await load_table_from_storage("entities", context.storage)
edges_actual = await load_table_from_storage("relationships", context.storage)

assert len(nodes_actual) == 251
assert len(edges_actual) == 372
assert len(nodes_actual) == 291
assert len(edges_actual) == 452

# x and y should have some value other than zero due to umap
assert nodes_actual["x"].sum() != 0
Expand Down
2 changes: 1 addition & 1 deletion tests/verbs/test_prune_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ async def test_prune_graph():

nodes_actual = await load_table_from_storage("entities", context.storage)

assert len(nodes_actual) == 20
assert len(nodes_actual) == 21
Loading