INNER CODE UNIT · Python
load_pysr_graph
astroautomata/SymbolicRegression.jl · benchmark/family_tree.py:6
def load_pysr_graph(jsonl_path, progress=True):
"""Load a PySR trace JSONL file into a NetworkX directed graph.
Args:
jsonl_path: Path to pysr_trace.jsonl
progress: Show progress bars
Returns:
NetworkX DiGraph with:
- Node attributes: tree, cost, loss, parent
- Edge attributes: type, time, mutation_details
"""
G = nx.DiGraph()
event_counts = {"mutate": 0, "crossover": 0, "tuning": 0, "other": 0}
edge_counts = {"parent": 0, "mutate": 0, "crossover": 0, "tuning": 0}
sample = None
with open(jsonl_path) as trace_file: