graph preparation