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
3 changes: 0 additions & 3 deletions graphgen/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@

import ray
import ray.data
from dotenv import load_dotenv
from ray.data import DataContext

from graphgen.bases import Config, Node
from graphgen.common import init_llm, init_storage
from graphgen.utils import logger

load_dotenv()


class Engine:
def __init__(
Expand Down
4 changes: 2 additions & 2 deletions graphgen/models/evaluator/kg/structure_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def _calculate_powerlaw_r2(degree_map: Dict[str, int]) -> Optional[float]:
log_frequencies = np.log(frequencies)

# Linear regression on log-log scale
r_value, *_ = stats.linregress(log_degrees, log_frequencies)
r2 = r_value**2
result = stats.linregress(log_degrees, log_frequencies)
r2 = result.rvalue**2

return float(r2)
except Exception as e:
Expand Down
3 changes: 3 additions & 0 deletions graphgen/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

import ray
import yaml
from dotenv import load_dotenv
from ray.data.block import Block
from ray.data.datasource.filename_provider import FilenameProvider

from graphgen.engine import Engine
from graphgen.operators import operators
from graphgen.utils import CURRENT_LOGGER_VAR, logger, set_logger

load_dotenv()

sys_path = os.path.abspath(os.path.dirname(__file__))


Expand Down
14 changes: 9 additions & 5 deletions webui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def run_graphgen(params: WebuiParams, progress=gr.Progress()):
"op_name": "generate",
"type": "map_batch",
"dependencies": ["partition"],
"save_output": True,
"execution_params": {"replicas": 1, "batch_size": 128},
"params": {
"method": params.mode,
Expand All @@ -168,14 +169,17 @@ def run_graphgen(params: WebuiParams, progress=gr.Progress()):
}
)

config = {"global_params": {"working_dir": working_dir}, "nodes": nodes}
config = {
"global_params": {
"working_dir": working_dir,
"graph_backend": "kuzu",
"kv_backend": "rocksdb",
},
"nodes": nodes,
}
Comment on lines +172 to +179
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The graph_backend and kv_backend are hardcoded in the configuration. This reduces the flexibility of the web application, as users cannot easily switch to other supported backends (e.g., networkx for graphs, json_kv for key-value stores) without modifying the source code. It would be better to expose these as configurable options in the UI, perhaps by adding them to the WebuiParams dataclass.


try:
# 4. Initialize and Run Engine
# Initialize Ray if not already running (Engine handles this mostly, but good for safety)
if not ray.is_initialized():
ray.init(ignore_reinit_error=True, log_to_driver=True)

engine = Engine(config, operators)

# Start with an empty dataset to kick off the pipeline
Expand Down
Loading