Fix contact tracing

A bug was introduced when improving performance in commit ee8722c
The visited nodes were not used correct during contact tracing.
This is now fixed, using the previous code to assign VisitedNodes.
A test is added to check the results.
Updated NEWS