initialize graph beginning to returned head