1: \begin{abstract}
2: In this paper, we formulate and investigate a generalized consensus algorithm which makes an attempt to unify distributed averaging and maximizing algorithms considered in the literature. Each node iteratively updates its state as a time-varying weighted average of its own state, the minimal state, and the maximal state of its neighbors. We prove that finite-time consensus is almost impossible for averaging under this uniform model. Both time-dependent and state-dependent graphs are considered, and various necessary and/or sufficient conditions are presented on the consensus convergence. For time-dependent graphs, we show that quasi-strong connectivity is critical for averaging, as is strong connectivity for maximizing. For state-dependent graphs defined by a $\mu$-nearest-neighbor rule, where each node interacts with its $\mu$ nearest smaller neighbors and the $\mu$ nearest larger neighbors, we show that $\mu+1$ is a critical threshold on the total number of nodes for the transit from finite-time to asymptotic convergence for averaging, in the absence of node self-confidence. The threshold is $2\mu$ if each node chooses to connect only to neighbors with unique values. Numerical examples illustrate the tightness of the
3: conditions. The results characterize some fundamental similarities and differences between distributed averaging and maximizing algorithms.
4: \end{abstract}
5: