Custom D3 mesh layout. Handles cyclic references with node duplication in the view