updated initialize method on graph