Topological Data Analysis of Collective Behavior