'Returns median value of a vertex , defined as the median position of the adjacent vertices
@param node node to process
@param adj_rank rank 1 less than the node\'s rank'

def median_value(self, node, adj_rank):

    adj_nodes = self.adj_position(node, adj_rank)
    l = len(adj_nodes)
    m = (l / 2)
    if (l == 0):
        return (-1.0)
    elif ((l % 2) == 1):
        return adj_nodes[m]
    elif (l == 2):
        return ((adj_nodes[0] + adj_nodes[1]) / 2)
    else:
        left = (adj_nodes[(m - 1)] - adj_nodes[0])
        right = (adj_nodes[(l - 1)] - adj_nodes[m])
        return (((adj_nodes[(m - 1)] * right) + (adj_nodes[m] * left)) / (left + right))
