Learning Closed Signal Flow Graphs