adding some graph calculations