returning correct cost for Exhaustive Search on toy topology