What does Causal Graphs, Suspense Entropy and Foreshadowing conclude, in numbers, about “The Causal Graph: Kahn's Topological Sort and Version Conflicts in a Setting”?

Answer: Chapters 1 and 2 use Kahn's topological sort and a version check grouped by key to find time paradoxes and attributes written with two values, and show that cross-volume retcons hide in implied order: one edge in volume six of an illustrative serial contradicts a chain of 10 edges written between volume 2 and volume 6.

Scope of the numbers: Its serials, readers and parameters are illustrative models; all calculations are generated by its programs; it is not legal, financial or investment advice, and it keeps one red line: no false suspense to win clicks. Marked boxes separate published evidence, runnable Python calculations (21 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 10

graph A plan12 nodes, 15 edges
removed in Kahn order12 of 12
order: F1 F2 E1 E2 F3 E3 E4 E5 E6 E7 E8 E9
verdict: acyclic, a consistent timeline exists
graph B plan+retcon12 nodes, 16 edges
removed in Kahn order2 of 12
order: F2 F3
stuck (on or behind a cycle)10
one cycle: E1 -> E2 -> E4 -> E5 -> E7 -> E8 -> E9 -> F1 -> E1
on that cycle8, stuck but off it: 2
verdict: time paradox, no reading order satisfies all edges
Show the full program
# Chapter 1. p11: Kahn's topological sort finds a time paradox in a serial.
# Nodes are setting facts (F) and plot events (E) of a toy serial; an edge
# u -> v reads "u must hold or happen before v" (causal or temporal).
# Kahn (1962) repeatedly removes a node of in-degree zero; any node that
# can never be removed lies on a cycle or downstream of one. Graph A is
# the plan; graph B adds one retcon edge written in volume 3. The graph is
# illustrative and is not taken from any published novel.
import heapq
from collections import defaultdict

PLAN = [
    ("F1", "E1"), ("F2", "E1"), ("E1", "E2"), ("E1", "E3"),
    ("F3", "E3"), ("E2", "E4"), ("E3", "E4"), ("E4", "E5"),
    ("E4", "E6"), ("E5", "E7"), ("E6", "E7"), ("E7", "E8"),
    ("E7", "E9"), ("F3", "E9"), ("E8", "E9"),
]
RETCON = ("E9", "F1")    # volume 3: the hero's son, born at E9, forged F1


def kahn(edges):
    nodes = sorted({u for u, _ in edges} | {v for _, v in edges})
    succ, indeg = defaultdict(list), {n: 0 for n in nodes}
    for u, v in edges:
        succ[u].append(v)
        indeg[v] += 1
    heap = [n for n in nodes if indeg[n] == 0]
    heapq.heapify(heap)
    order = []
    while heap:
        n = heapq.heappop(heap)
        order.append(n)
        for v in sorted(succ[n]):
            indeg[v] -= 1
            if indeg[v] == 0:
                heapq.heappush(heap, v)
    left = [n for n in nodes if n not in order]
    return nodes, order, left, succ


def one_cycle(left, succ):
    rest = set(left)
    start = sorted(left)[0]
    path, seen = [start], {start: 0}
    while True:
        nxt = sorted(v for v in succ[path[-1]] if v in rest)
        # follow a successor that can still reach the start, else any
        step = None
        for v in nxt:
            if reaches(v, start, succ, rest):
                step = v
                break
        if step is None:
            return None
        if step in seen:
            return path[seen[step]:] + [step]
        seen[step] = len(path)
        path.append(step)


def reaches(a, b, succ, rest):
    stack, seen = [a], {a}
    while stack:
        n = stack.pop()
        if n == b:
            return True
        for v in succ[n]:
            if v in rest and v not in seen:
                seen.add(v)
                stack.append(v)
    return False


for name, edges in (("A plan", PLAN), ("B plan+retcon", PLAN + [RETCON])):
    nodes, order, left, succ = kahn(edges)
    print("graph {}: {} nodes, {} edges".format(name, len(nodes),
                                                 len(edges)))
    print("  removed in Kahn order: {} of {}".format(len(order),
                                                    len(nodes)))
    print("  order: " + " ".join(order))
    if not left:
        print("  verdict: acyclic, a consistent timeline exists")
        continue
    cyc = one_cycle(left, succ)
    on = set(cyc)
    print("  stuck (on or behind a cycle): {}".format(len(left)))
    print("  one cycle: " + " -> ".join(cyc))
    print("  on that cycle: {}, stuck but off it: {}".format(
        len(on), len([n for n in left if n not in on])))
    print("  verdict: time paradox, no reading order satisfies all edges")

Single source and citation

Fan, Y. (2026). Causal-DAG Validation of Long-Form Narrative, Sawtooth Scheduling of Chapter Suspense Entropy and Forgetting-Aware Foreshadowing Recovery (Version 1.0.0), Chapter 1: The Causal Graph: Kahn's Topological Sort and Version Conflicts in a Setting. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-178 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026178,
  author    = {Fan, Yafu},
  title     = {Causal-DAG Validation of Long-Form Narrative, Sawtooth Scheduling of Chapter Suspense Entropy and Forgetting-Aware Foreshadowing Recovery},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book