给定带耗时的任务和依赖边,如何判环、求最短完成时间与关键路径,并输出可并行的拓扑批次?
Sorry o(╥﹏╥)o,暂无参考答案。带这道题,问问AI吧~
问 AI
本题目录
相关面经
1 篇元戎启行
前端秋招三面
现在有一个DAG 任务调度系统,dag的结构如下 type Node struct { ID string Duration int } type Edge struct { From string To string } 实现: func Analyze(nodes []Node, edges []Edge) ( hasCycle bool, minDuration int, criticalPath []string, batches [][]string, ) 假设资源无限。 要求: 判断 DAG 是否有环; 无环时计算 Workflow 最短完成时间; 输出一条 Critical Path; 输出可以并行执行的拓扑批次。
