Small functionality for working with graph