A priority queue with a vector of priorities

This is fairly straightforward. I need to create a structure with keys and priorities. Then, priority queue would be a good candidate. For my understanding, each pair in the default priority queue of Julia has only one key element and one priority element. What if I’d like to have two priorities, such that in case that the first priority is the same, then order it based on the second priority? Does Julia have a structure for this?

julia> using DataStructures

julia> q = PriorityQueue{String, Tuple{Int,Int}}()
PriorityQueue{String,Tuple{Int64,Int64},Base.Order.ForwardOrdering} with 0 entries

julia> enqueue!(q, "a", (1, 1))
PriorityQueue{String,Tuple{Int64,Int64},Base.Order.ForwardOrdering} with 1 entry:
  "a" => (1, 1)

julia> enqueue!(q, "b", (1, 2))
PriorityQueue{String,Tuple{Int64,Int64},Base.Order.ForwardOrdering} with 2 entries:
  "b" => (1, 2)
  "a" => (1, 1)

julia> enqueue!(q, "c", (2, 1))
PriorityQueue{String,Tuple{Int64,Int64},Base.Order.ForwardOrdering} with 3 entries:
  "c" => (2, 1)
  "b" => (1, 2)
  "a" => (1, 1)
3 Likes