mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
23 lines
656 B
Python
23 lines
656 B
Python
import pytest
|
|
|
|
from semantica.export.graph_exporter import GraphExporter
|
|
|
|
|
|
@pytest.mark.benchmark(group="vis_export")
|
|
@pytest.mark.parametrize("format", ["graphml", "gexf"])
|
|
def test_graph_conversion_overhead(
|
|
benchmark, tmp_path, generate_knowledge_graph, format
|
|
):
|
|
"""
|
|
Measures the cost of converting internal KG structure to XML-based graph formats.
|
|
Includes dictionary traversal and XML string building.
|
|
"""
|
|
kg = generate_knowledge_graph(2000)
|
|
exporter = GraphExporter(format=format)
|
|
output_file = tmp_path / f"graph.{format}"
|
|
|
|
def run():
|
|
exporter.export_knowledge_graph(kg, output_file)
|
|
|
|
benchmark(run)
|