For $f:S^1\to M$ a knot in a 3-manifold, we can construct a 3-manifold $N$ by a *$0/1$-type Dehn surgery* along $f$:


1. First remove from $M$ a solid torus which is a tubular neighbourhood of the knot $f$;
2. Thereafter $N$ is the result of sewing this solid torus back in $M$ such that the meridian disc goes 1 time along the longitude and 0 times along the meridian.


Does the integral cohomology groups $H^1(N;{\mathbb{Z}})$ and $H^2(N;{\mathbb{Z}})$ depend only on the integral cohomology of $M$ or do they also depend on how the knot $f$ sits in $M$?


I [asked this on Math Stack Exchange](https://math.stackexchange.com/questions/764577/cohomology-after-dehn-surgery) but did not receive response.



Does the cohomology after Dehn surgery depend only on the original 3-manifold or also how the knot is situated?
It depends on the homology class of the knot, and also on the framing, which in your terminology is the choice of longitude. For knots in the 3-sphere (or more generally in a homology 3-sphere), there is a well-defined 0-framing, and that gives the longitude. So in general, you should ask about surgery on a knot with a given framing. A correct statement might be that if you have two homologous knots, $K\_0$ and $K\_1$, then there is a correspondence between their framings; moreover surgery on $K\_0$ and $K\_1$ with corresponding framings gives manifolds with the same homology.


If you want to figure out how the homology changes, then you'll find that the dependence on the homology class is maybe a little subtle, although it is an excellent exercise to figure out what is going on. For instance, surgery on a null-homologous knot with an appropriate framing will increase the first Betti number, but surgery on a knot carrying a homology class of infinite order will decrease $b\_1$. For knots whose homology class is torsion in $H\_1(M)$, the rational-valued self-linking plays a crucial role.


You might find it useful to look at the early papers on surgery theory, eg section 5 of Kervaire-Milnor, Groups of homotopy spheres. I. Ann. of Math. (2) {\bf 77} 1963 504–537. The paper of Wall, Killing the middle homotopy groups of odd dimensional manifolds. Trans. Amer. Math. Soc. 103 1962 421–433, is perhaps even more useful, because it explains the role of the self-linking form more explicitly. 


