def load_nodes(nodes_dmp):
    """Load the NCBI taxdump nodes.dmp file.

    Returns three dicts, the parent/child relationships (two directions),
    and the rank of each node.
    """
    tree = {}
    ranks = {}
    descendants = {}
    with open(nodes_dmp) as handle:
        for line in handle:
            parts = line.split('\t|\t', 3)
            taxid = int(parts[0].strip())
            parent = int(parts[1].strip())
            rank = parts[2].strip()
            tree[taxid] = parent
            ranks[taxid] = rank
            try:
                descendants[parent].add(taxid)
            except KeyError:
                descendants[parent] = {taxid}
    return tree, descendants, ranks
