equal
deleted
inserted
replaced
193 options: Options, |
193 options: Options, |
194 graph: Graph, |
194 graph: Graph, |
195 levels: List[Level] |
195 levels: List[Level] |
196 ): List[Level] = { |
196 ): List[Level] = { |
197 def resort(parent: Level, child: Level, top_down: Boolean): Level = |
197 def resort(parent: Level, child: Level, top_down: Boolean): Level = |
198 child.map(v => { |
198 child.map({ v => |
199 val ps = if (top_down) graph.imm_preds(v) else graph.imm_succs(v) |
199 val ps = if (top_down) graph.imm_preds(v) else graph.imm_succs(v) |
200 val weight = |
200 val weight = |
201 ps.foldLeft(0.0) { case (w, p) => w + (0 max parent.indexOf(p)) } / (ps.size max 1) |
201 ps.foldLeft(0.0) { case (w, p) => w + (0 max parent.indexOf(p)) } / (ps.size max 1) |
202 (v, weight) |
202 (v, weight) |
203 }).sortBy(_._2).map(_._1) |
203 }).sortBy(_._2).map(_._1) |