Added a method to return JSON for the graph object