High-level description of a Turing Machine that decides whether a graph G is connected
M2 = "On input string <G>, the encoding of G:
- Select the first node of G and mark it.
- Repeat the following stage until no new nodes are marked:
-     For each node in G, mark it if it is attached by
an edge to a node that is already marked.
- Scan all the nodes of G to determine whether they are all
marked. If yes, accept; otherwise, reject.