We study two agent based models of opinion formation -one stochastic in nature and one deterministic. Both models are defined in terms of an underlying graph; we study how the structure of the graph affects the long time behavior of the models in all possible cases of graph topology. We are especially interested in the emergence of a consensus among the agents and provide a condition on the graph that is necessary and sufficient for convergence to a consensus in both models. This investigation reveals several contrasts between the models -notably the convergence rates -which are explored through analytical arguments and several numerical experiments.