Show that a connected graph retracts onto any connected subgraph.
Solution
Let \(A\subseteq X\) be a connected subgraph. Choose a vertex \[ a_0\in A. \]
1. Define a map on the vertices of \(X\) by\[ r(v)= \begin{cases} v,&v\in A,\\a_0,&v\notin A. \end{cases} \]
This already restricts to the identity on the \(0\)-skeleton of \(A\).
2. For every edge \(e\) of \(X\) not contained in \(A\), extend \(r\) continuously across \(e\) by mapping it to a path in \(A\) joining the images of its endpoints.
Let the endpoints of \(e\) be \(v,w\). Since \(A\) is connected, hence path connected as a graph, there is an edge path \[ \alpha_e:I\to A \] from \(r(v)\) to \(r(w)\). Choose a characteristic parametrization of \(e\) by \(I\) and define \(r\) on \(e\) to be \(\alpha_e\). For an edge lying in \(A\), define \(r\) to be the identity. The definitions agree at all common endpoints by construction.
3. The resulting map\[ r:X\to A \]is continuous.
Its restriction to the closure of every edge is continuous by 2, and its restriction to the \(0\)-skeleton is continuous. The graph has the weak CW topology, so a map out of \(X\) is continuous precisely when its restrictions to the closed cells are continuous. Hence \(r\) is continuous.
4. The map \(r\) is a retraction of \(X\) onto \(A\).
On every vertex and every edge of \(A\), the construction used the identity map. Thus \[ r|_A=\operatorname{id}_A. \]