LinearGraph's remove, connect and disconnect methods optimizations.
LinearGraph optimization.
SPEC: Remove last node of the linear graph.
LinearGraph.remove optimization.
SPEC: Remove the first node of the linear graph.
SPEC: Remove the middle node of the linear graph.