graph tested and works