Graph-Theory Algorithms for Dynamic Hydrogen-Bonded Networks in Proteins and Lipid Membranes