"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Graph = void 0;
var Graph;
(function (Graph) {
    function from(job) {
        const nodes = new Map(job.steps.map((step) => [
            step.id,
            {
                step,
                parents: [],
            },
        ]));
        for (const node of nodes.values()) {
            for (const dependency of node.step.dependencies) {
                const parent = nodes.get(dependency.id);
                if (parent) {
                    node.parents.push(parent);
                }
            }
        }
        return {
            job,
            nodes: Array.from(nodes.values()),
        };
    }
    Graph.from = from;
})(Graph = exports.Graph || (exports.Graph = {}));
//# sourceMappingURL=graph.js.map