move graph-state-snapshot function to graph.rb