Linear-Time Primitives for Algorithm Development in Graphical Causal Inference