From basic algebra, I am familiar with the concept of splitting in the context of group extensions. Namely, the short exact sequence
$1 \rightarrow K \rightarrow G \rightarrow H \rightarrow 1$
is said to split if there is a homomorphism $s : H \rightarrow G$ such that going from H to G by s and then back to H by the quotient map of the short exact sequence has the effect of the identity map on H.
Now, I recently came across another definition of splitting in the context of Bass-Serre Theory.
An isomorphism between a group G and the fundamental group of a graph of groups is called a splitting of G.
My Question: What is the precise relationship (if there is one) between these two types of splitting?
The first implies that G is a semidirect product of K and H. However (and please correct me if this is not correct), but an HNN extension need not split in the sense of our first definition from basic algebra. For instance, if the HNN extension of a group G with respect to the isomorphism of subgroups $\alpha : H \rightarrow K$ with $H = K = \{ e \}$, then the usual HNN relation of the form $t h t^{-1} = \alpha(h)$ with stable letter t can be eliminated since $tet^{-1} = e$, so that the HNN extension of the group G would be isomorphic to $G \ast \langle t \rangle$). But $G \ast \langle t \rangle \not\cong G \rtimes \langle t \rangle $. However, since HNN extensions are a special case of a graph of groups decomposition, then this would mean $G \ast \langle t \rangle$ still splits according to the second notion of splitting. Nevertheless, the ideas still seem very related. Can the first type maybe be expressed as a special case of the second with some restriction on which graphs of groups are "legal" to decompose to?
I would appreciate any insight you guys may have! Thanks!