added support for Comparator
minor updates
implemented Dijkstra's algorithm using heap