code: def get_node_id(edge, node_type):
      
      assert node_type in ('source', 'target')
      _, node_id_str = edge.attrib[node_type].split('.')  # e.g. //@nodes.251
      return int(node_id_str)
docs: returns the source or target node id of an edge, depending on the
      node_type given.