The precise definition of (finite) linear graph?

In Munkres' book "Topology", (finite) linear graph is defined in P.308, Example 6, as the following picture shows.

The implication from compact to closed for edges demands that these edges be regarded as compact subspaces of $G$, which, however, is not mentioned in the definition of (finite) linear graph in this paragraph. I searched the Internet but did not find its precise definition, so I hope I can find help here: what is the precise definition of (finite) linear graph? Is it indispensable that each edge, or arc, is a subspace of $G$?
Another question: if we union a number of spaces $X_i$ together, can the union $X=\cup X_i$ be topologized such that each $X_i$ is a subspace of the union space $X$?
Thanks!