Added graph algorithms and other utility functions