fix bug in data.Graph and add a new method