def calculate_size(petrinet):
    """ This function calculates the size and minimum coordinate
    of the Petri net.

    return: ((width, height), (min_x, min_y))
    """
    
    minmax = [0, 0, 0, 0]
    for id, transition in petrinet.transitions.items():
        x, y = transition.position
        if x < minmax[0]:
            minmax[0] = x
        if x > minmax[2]:
            minmax[2] = x
        if y < minmax[1]:
            minmax[1] = y
        if y > minmax[3]:
            minmax[3] = y

    for id, place in petrinet.places.items():
        x, y = place.position
        if x < minmax[0]:
            minmax[0] = x
        if x > minmax[2]:
            minmax[2] = x
        if y < minmax[1]:
            minmax[1] = y
        if y > minmax[3]:
            minmax[3] = y

    width = minmax[2] - minmax[0] + 100
    height = minmax[3] - minmax[1] + 100

    offx = minmax[0]
    if offx != 0:
        offx - 50;
    offy = minmax[1]
    if offy != 0:
        offy - 50;
    
    
    return ((width, height), (offx, offy))