For connections along the coast and in the far north you have to go with buses. For example from Bodö/Fauske to Narvik, to the Lofoten or from Narvik to North Cape. Narvik is connected by train from Sweden.
There are two main routes to travel from Norway to Sweden by train. The one in the North from Narvik via Abisko down to Stockholm. The second one in the South from Oslo in direction of Göteborg. In both countries you find very good night train connections to travel long-distance.
The railway network in the North of Norway is not connected between Bodö and Narvik. You have to take the bus for this part.