import forEach_default from "../../../../lodash-es/forEach.js";
import map_default from "../../../../lodash-es/map.js";
import min_default from "../../../../lodash-es/min.js";
function longestPath(r) {
	var i = {};
	function a(e) {
		var o = r.node(e);
		if (Object.prototype.hasOwnProperty.call(i, e)) return o.rank;
		i[e] = !0;
		var s = min_default(map_default(r.outEdges(e), function(e) {
			return a(e.w) - r.edge(e).minlen;
		}));
		return (s === Infinity || s == null) && (s = 0), o.rank = s;
	}
	forEach_default(r.sources(), a);
}
function slack(e, n) {
	return e.node(n.w).rank - e.node(n.v).rank - e.edge(n).minlen;
}
export { longestPath, slack };
