let rank e =
    try ElemTable.find ranks e with Not_found -> 0