Graph building partly implemented