INNER CODE UNIT · Python

_build_dag_figure

F-R-L/forge-film · forge/webui/app.py:29

def _build_dag_figure(plan):
    """Return a matplotlib Figure visualizing the DAG."""
    fig, ax = plt.subplots(figsize=(max(6, len(plan.scenes) * 1.2), 4))
    ax.set_xlim(0, len(plan.scenes) + 1)
    ax.set_ylim(-1, 2)
    ax.axis("off")
    ax.set_title(f"{plan.title} — DAG", fontsize=13, fontweight="bold")

    scene_ids = [s.id for s in plan.scenes]
    x_pos = {sid: i + 1 for i, sid in enumerate(scene_ids)}
    y_pos = 0.5

    # Draw edges
    for src, dsts in plan.dag.items():
        for dst in dsts:
            if src in x_pos and dst in x_pos:
                ax.annotate(
                    "",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…