def get_layout_characteristics(n2lo):
    """
    Checks the layout values for all the elements and finds the coordinates of the top left corner,
    the width and the height or the area containing the graph and the height of the minimal element.
    :param n2lo: node layout as a dictionary    {node_id: ((x, y), (w, h)) if node is not ubiquitous
                                                else node_id : {r_ids: ((x, y), (w, h)) for r_ids of
                                                reactions using each duplicated metabolite}}
    :return: h_min, (x_min, y_min), (w, h): the height of the minimal element, the coordinates of the top left corner,
                                            the width and the height or the area containing the graph.
    """
    x_min, y_min, x_max, y_max, h_min = None, None, None, None, None
    for v in n2lo.values():
        if not isinstance(v, dict):
            v = {'': v}
        for (x, y), (w, h) in v.values():
            if x_min is None or x - w / 2 < x_min:
                x_min = x - w / 2
            if x_max is None or x + w / 2 > x_max:
                x_max = x + w / 2
            if y_min is None or y - h / 2 < y_min:
                y_min = y - h / 2
            if y_max is None or y + h / 2 > y_max:
                y_max = y + h / 2
            if h_min is None or h < h_min:
                h_min = h
    w, h = x_max - x_min, y_max - y_min
    return h_min, (x_min, y_min), (w, h)
