Add graph methods and tests