import math


def _dist(i_node, j_node, dist_type) -> float:
    """Returns the distance between two nodes.

    dist_type is either 'manhattan' or 'euclidean'
    """

    if dist_type == 'manhattan':
        return (abs(float(i_node['cx']) - float(j_node['cx'])) +
                abs(float(i_node['cy']) - float(j_node['cy'])))

    # otherwise assume euclidean
    return math.sqrt(
        (float(i_node['cx']) - float(j_node['cx']))**2 +
        (float(i_node['cy']) - float(j_node['cy']))**2)