Topology on a graph as a CW-complex I want to make sure I'm correctly understanding the topology that a graph is given when thought of as a $1$-complex. From what I can tell, the topology should be generated by sets of the following types:

*

*An isolated vertex.

*A vertex together with open segments of all the edges adjacent to it.

*An open segment of some edge (not containing either adjacent vertex).

These should both be open sets because in the first case, the preimage under each attaching map is just the vertex or the empty set, and in the second, the preimage under each attaching map looks like $[0, \epsilon)$ or $(1 - \epsilon, 1]$ for some $\epsilon > 0$, or the empty set, or just the vertex. Further, if $U$ is an open set and $v$ is a vertex in $U$, then $U$ must include a segment of each edge adjacent to $v$, since otherwise the preimage of $U$ in the attaching map for an edge adjacent to $v$ is just $\{0\}$ or $\{1\}$. If $u \in U$ is a point on some edge then $U$ must contain an open interval around $u$ by similar reasoning.
This seems like a satisfactory definition of the topology, but I'm nagged by a doubt: Wouldn't the graphs $\cdot - \cdot - \cdot$ and $\cdot - \cdot$ be the topologically indistinguishable? In both cases it seems the graph is homeomorphic to a closed interval in the real line, because any open set containing the middle vertex of the first graph has to contain some of the edges on both sides. Do I have the topology wrong, or is homeomorphism just not a strong form of equivalence for graphs?
 A: A graph consists of set $V$ of vertices and a set $E$ of edges. It seems that you consider undirected graphs. In this case the elements of $E$ are sets of the form $\{x,y\}$ with $x,y \in V$. If you require $x \ne y$ for all these sets, we get a undirected simple graph. If you allow $x = y$, the graph is allowed to have loops. You may also consider more than one edge having given vertices; this results in the concept of an undirected multigraph. Formally you could define $E$ to be the set of all pairs $(\{x,y\},n_{\{x,y\}})$ with $x,y \in V$ and $n_{\{x,y\}} \in \mathbb N_0 = \{0,1,2,\ldots \}$. If $n_{\{x,y\}} = 0$, there is no edge connecting the vertices $x$ and $y$. If you require that all $n_{\{x,y\}} \le 1$, you get the above concept of an undirected simple graph with loops.
A graph is often visualized by a drawing like

This is in some sense misleading because it suggests that the edges are line segments - but they are not. A graph is just a combinatorial object and it is an unsuitable object to receive a topology.
However, we can assign to each graph $G$ a $1$-dimensional CW-complex $X_G$ which we may denote as its geometric realization.
As the $0$-cells of $X_G$ take the vertices. For each combinatorial edge $e = \{x,y\}$ attach a $1$-cell $D^1 = [-1,1]$ via  $\phi_e : \partial D^1 = \{-1,1\} \to X_G^0, \phi(-1) = v, \phi(1) = y$. Here you have two choices for $\phi_e$ if $x \ne y$, but this turns out to be irrelevant for the resulting CW-complex.
Since this procedure gives a CW-complex, the topology on $X_G$ is completely determined. If you imagine graphs in terms of "drawn graphs" as in the picture above, you perform exactly this construction. And you are right, this "geometric object" has the topology described in your question.
There is in fact a $1$-$1$ correspondence between $1$-dimensional CW-complexes and undirected multigraphs with loops.
As you have shown, distinct graphs can produce homeomorphic CW-complexes. But a CW-complex is not the same object as a topological space; it is a topological space plus an additional structure (the collection of cells). As an analogue consider a group - this is a set plus an additional structure, and it would be inadequate to forget this structure when comparing groups.
If you want to work with CW-complexes, you have to take into account their CW-structure. Not every continuous map between CW-complexes is compatible with this structure; thus one works with cellular maps and gets cellular homeomorphims. In your example you get two CW complexes which are homeomorphic as topological spaces, but are not cellularly homeomorphic.
