Function setGraphEventHandlers