graphrag/tests/verbs/test_prune_graph.py
Nathan Evans 69ad36e735
Some checks failed
gh-pages / build (push) Has been cancelled
Python CI / python-ci (ubuntu-latest, 3.10) (push) Has been cancelled
Python CI / python-ci (ubuntu-latest, 3.11) (push) Has been cancelled
Python CI / python-ci (windows-latest, 3.10) (push) Has been cancelled
Python CI / python-ci (windows-latest, 3.11) (push) Has been cancelled
Python Integration Tests / python-ci (ubuntu-latest, 3.10) (push) Has been cancelled
Python Integration Tests / python-ci (windows-latest, 3.10) (push) Has been cancelled
Python Notebook Tests / python-ci (ubuntu-latest, 3.10) (push) Has been cancelled
Python Notebook Tests / python-ci (windows-latest, 3.10) (push) Has been cancelled
Python Publish (pypi) / Upload release to PyPI (push) Has been cancelled
Python Smoke Tests / python-ci (ubuntu-latest, 3.10) (push) Has been cancelled
Python Smoke Tests / python-ci (windows-latest, 3.10) (push) Has been cancelled
Spellcheck / spellcheck (push) Has been cancelled
Fix id baseline (#2036)
* Fix all human_readable_id columns to start at 0

* Semver
2025-08-27 11:15:21 -07:00

32 lines
902 B
Python

# Copyright (c) 2024 Microsoft Corporation.
# Licensed under the MIT License
from graphrag.config.create_graphrag_config import create_graphrag_config
from graphrag.config.models.prune_graph_config import PruneGraphConfig
from graphrag.index.workflows.prune_graph import (
run_workflow,
)
from graphrag.utils.storage import load_table_from_storage
from .util import (
DEFAULT_MODEL_CONFIG,
create_test_context,
)
async def test_prune_graph():
context = await create_test_context(
storage=["entities", "relationships"],
)
config = create_graphrag_config({"models": DEFAULT_MODEL_CONFIG})
config.prune_graph = PruneGraphConfig(
min_node_freq=4, min_node_degree=0, min_edge_weight_pct=0
)
await run_workflow(config, context)
nodes_actual = await load_table_from_storage("entities", context.output_storage)
assert len(nodes_actual) == 20