Topological sorting reference image