only return valid graphs