Build one graph for each query