nice! you could also make versions where the border has to be on the coast or not on the coast. Eg Brazil-Venezuela border isn't on the coast, Mexico-United States is
Interesting idea! I think each pair's total length of coastline would be a more intuitive thing to list here. Average rank is such an abstract concept.