iterative DFS, multithreading graph build (node linking)