beginning of some graph related stuff