Median computation in graphs using consensus strategies