in src/lic/ppl/world/diff_stack.py [0:0]
def __init__(self, diff: Optional[Diff] = None):
# diff_stack_ is the list of diffs where the last element is the latest
# diff added to diff_stack_.
self.diff_stack_ = []
# diff_var_ is the set of random variable available in diff stack.
self.diff_var_ = set()
# node_to_diffs_ is the dictionary to map node's to the index of the
# diffs in the diff stack that holds them. This makes node look-up much
# faster in the diff stack because we no longer need to go look for them
# in each diff in the diff stack.
self.node_to_diffs_ = defaultdict(list)
if diff is None:
diff = Diff()
self.add_diff(Diff())
# diff_ is the latest diff in the diff stack.
self.diff_ = self.diff_stack_[-1]