Skip to main content
1 of 2
ovs
  • 60.6k
  • 3
  • 47
  • 161

Coconut, 45 bytes

Takes the graph in the format shown in the example test case

f=(g,s)->[s]+max(map(f$g,g[s])::[[]],key=len)

Try it online!

Uses Coconuts lambda syntax, $ for partial application and :: as an operator for itertools.chain.

ovs
  • 60.6k
  • 3
  • 47
  • 161