move graph edge weight incr code into graph class