Minimizing the probability of error for decision making over graphs