import isArray_default from "../../../../lodash-es/isArray.js";
import forEach_default from "../../../../lodash-es/forEach.js";
function dfs(r, i, a) {
	isArray_default(i) || (i = [i]);
	var o = (r.isDirected() ? r.successors : r.neighbors).bind(r), s = [], c = {};
	return forEach_default(i, function(e) {
		if (!r.hasNode(e)) throw Error("Graph does not have node: " + e);
		doDfs(r, e, a === "post", c, o, s);
	}), s;
}
function doDfs(e, r, i, a, o, s) {
	Object.prototype.hasOwnProperty.call(a, r) || (a[r] = !0, i || s.push(r), forEach_default(o(r), function(n) {
		doDfs(e, n, i, a, o, s);
	}), i && s.push(r));
}
export { dfs };
