added graph structures and some functions