docs: def __edge_weight(edge_id, dfs_data):
      """Calculates the edge weight used to sort edges."""
      graph = dfs_data['graph']
      edge_lookup = dfs_data['edge_lookup']
  
      edge = graph.get_edge(edge_id)
      u, v = edge['vertices']
      d_u = D(u, dfs_data)
      d_v = D(v, dfs_data)
      lp_1 = L1(v, dfs_data)
      d_lp_1 = D(lp_1, dfs_data)
  
      if edge_lookup[edge_id] == 'backedge' and d_v < d_u:
          return 2*d_v
      elif is_type_I_branch(u, v, dfs_data):
          return 2*d_lp_1
      elif is_type_II_branch(u, v, dfs_data):
          return 2*d_lp_1 + 1
      else:
          return 2*graph.num_nodes() + 1