testing with refinement and graph theory