Save graph function implemented