How to set an overlap priority for edges?

Hello everyone, I am new here, so please let me know if I made any mistakes with this topic and if it has already been answered previously.

I am currently developing a network, in which I am interested in highlighting the weights of the edges (doing it by color [grey scale] and width), however due to overlapping some edges are covering the ones with the highest weights as shown in the picture below.

Considering that for my purposes it is acceptable that the edges overlap, but I would prefer that the edges with higher weights always overlap the elesser ones, is there a way to set an overlapping priority for the edges?

The current plotting code is:

network <- graph.adjacency(MatP2,mode = "undirected", diag = FALSE, 
                           weighted = TRUE)

edges <- as_data_frame(network, what="edges")
Ecolor <- c(rep("gray90",length(edges$weight)))
Ewidth <- 20 * edges$weight
for (z in 1: length(Ecolor)){
  if (Ewidth[z] > 8){
    Ecolor[z] <- "gray70"
  if (Ewidth[z] > 10){
    Ecolor[z] <- "gray50"
  if (Ewidth[z] > 12){
    Ecolor[z] <- "gray30"
  if (Ewidth[z] > 14){
    Ecolor[z] <- "gray10"

plot(network, vertex.color=Vcolor, vertex.size=Vsize, 
     vertex.label.color="black", vertex.frame.color="black",
     edge.color=Ecolor , edge.width=Ewidth)