Simplify a trajectory by removing transient milestones

Transient milestones are milestones with a degree of two (if undirected) or with an indegree of one and outdegree of one (if directed)

simplify_trajectory(trajectory, allow_self_loops = FALSE)



The trajectory as created by infer_trajectory() or add_trajectory()


Whether or not to allow self loops.


The positions of the cells within the trajectory remain the same

A -> B -> C is simplified to A -> C.

A — B — C is simplified to A — C.

A -> B -> C -> D -> A is simplified to A -> B -> D.