Algorithms for analyzing data with persistent homology