I think you can do this with vertex reduction. Just a hint here:
First vertex connected components connected by 0-weight edges, and select one representative element in each component. This will give you an abbreviated schedule.
Then solve the unweighted problem.
The true path will be formed from the "intercostal space" (weight 1) connecting the representative members, and the "intercostal space" connecting the vertices inside the component, from the incoming intercostal space to the outgoing intercostal space. In other words, you need to find a way from any representative to any other representative.
Yves daoust
source share