Best path Template for best part solution in directed graphs. Tested under Matlab R2018b Update 8 (9.5.0) and R2021b (9.11.0). Contact me at LinkedIn.