nodes: 0, module; 1, function_definition; 2, function_name:__edge_weight; 3, parameters; 4, block; 5, identifier:edge_id; 6, identifier:dfs_data; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, if_statement; 17, comment:"""Calculates the edge weight used to sort edges."""; 18, assignment; 19, assignment; 20, assignment; 21, assignment; 22, assignment; 23, assignment; 24, assignment; 25, assignment; 26, boolean_operator; 27, block; 28, elif_clause; 29, elif_clause; 30, else_clause; 31, identifier:graph; 32, subscript; 33, identifier:edge_lookup; 34, subscript; 35, identifier:edge; 36, call; 37, pattern_list; 38, subscript; 39, identifier:d_u; 40, call; 41, identifier:d_v; 42, call; 43, identifier:lp_1; 44, call; 45, identifier:d_lp_1; 46, call; 47, comparison_operator:edge_lookup[edge_id] == 'backedge'; 48, comparison_operator:d_v < d_u; 49, return_statement; 50, call; 51, block; 52, call; 53, block; 54, block; 55, identifier:dfs_data; 56, string; 57, identifier:dfs_data; 58, string; 59, attribute; 60, argument_list; 61, identifier:u; 62, identifier:v; 63, identifier:edge; 64, string; 65, identifier:D; 66, argument_list; 67, identifier:D; 68, argument_list; 69, identifier:L1; 70, argument_list; 71, identifier:D; 72, argument_list; 73, subscript; 74, string; 75, identifier:d_v; 76, identifier:d_u; 77, binary_operator:2*d_v; 78, identifier:is_type_I_branch; 79, argument_list; 80, return_statement; 81, identifier:is_type_II_branch; 82, argument_list; 83, return_statement; 84, return_statement; 85, string_content:graph; 86, string_content:edge_lookup; 87, identifier:graph; 88, identifier:get_edge; 89, identifier:edge_id; 90, string_content:vertices; 91, identifier:u; 92, identifier:dfs_data; 93, identifier:v; 94, identifier:dfs_data; 95, identifier:v; 96, identifier:dfs_data; 97, identifier:lp_1; 98, identifier:dfs_data; 99, identifier:edge_lookup; 100, identifier:edge_id; 101, string_content:backedge; 102, integer:2; 103, identifier:d_v; 104, identifier:u; 105, identifier:v; 106, identifier:dfs_data; 107, binary_operator:2*d_lp_1; 108, identifier:u; 109, identifier:v; 110, identifier:dfs_data; 111, binary_operator:2*d_lp_1 + 1; 112, binary_operator:2*graph.num_nodes() + 1; 113, integer:2; 114, identifier:d_lp_1; 115, binary_operator:2*d_lp_1; 116, integer:1; 117, binary_operator:2*graph.num_nodes(); 118, integer:1; 119, integer:2; 120, identifier:d_lp_1; 121, integer:2; 122, call; 123, attribute; 124, argument_list; 125, identifier:graph; 126, identifier:num_nodes
code: 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