Refactored graph test functions