fn kahn<K: Ord>( n: usize, edges: &[Vec<usize>], open: &[bool], key: impl Fn(usize) -> K, ) -> Vec<usize>
Kahn’s algorithm over the open tasks, the smallest key first among those free.