addEvent method
Adds an event to the graph manually.
If event.parentId is non-null and the parent exists in the graph,
a directed edge (child → parent) is created.
Implementation
void addEvent(CausalEvent event) {
_nodes[event.id] = event;
if (event.parentId != null) {
_parentEdge[event.id] = event.parentId!;
_childEdges.putIfAbsent(event.parentId!, () => []).add(event.id);
}
_pruneIfNeeded();
}