move graph-related to separate file