Solve the Trolley Problem
Python 3, 80 bytes



y=lambda d,s=0,p=[],f=0:f in p and s or min(y(d,s+d[f][t],p+[f],t)for t in d[f])


Try it online!

Takes input as a dictionary keyed by node id.  The entries are a dictionary of neighbors and the number of people on the track between a node and the neighbor.  E.g., for the first test case:

{0: {1: 0}, 1: {2: 5, 3: 1}, 2: {2: 0}, 3: {3: 0}}


0 is the start node, 1 is node 'a', 2 is node 'b', etc.