Inverse Problems on Electrical Networks and in Photoacoustic Tomography