Find an algorithm that sorts the nodes of a given graph acc. to distance from source node + value of the node's key
Hint:


Use BFS to calculate the distances.
Calculate the scores (sums of distance to source and serial number).
Use counting sort to sort the scores.
Go over the list again and output the vertices in sorted order.