effectgraph
v0.4.1
Published
Deterministic resource effect graphs and execution waves for concurrent operations.
Maintainers
Readme
effectgraph
Deterministic resource effect graphs and execution waves for concurrent operations.
Powered by the EffectPlan deterministic planning engine.
# npm
npm install effectgraph
# pnpm
pnpm add effectgraph
# yarn
yarn add effectgraphQuickstart
import { plan } from "effectgraph";
const graph = await plan({
calls: [
{ id: "read_customer", reads: ["db:cust_402"] },
{ id: "update_customer", writes: ["db:cust_402"] },
{ id: "send_receipt", writes: ["email:cust_402"] },
{ id: "audit_log", reads: ["db:cust_402"] }
]
});
console.log("Parallel execution waves:", graph.levels);
// Wave 0: ["read_customer", "send_receipt"] <-- safe to run in parallel
// Wave 1: ["update_customer"]
// Wave 2: ["audit_log"]Critical Path & Makespan Analysis
import { planWithTiming } from "effectgraph";
const schedule = await planWithTiming({
calls: [
{ id: "fetch_data", reads: ["api:orders"], durationTicks: 30 },
{ id: "process_data", writes: ["api:orders"], durationTicks: 50 },
{ id: "generate_report", reads: ["api:orders"], durationTicks: 20 }
]
});
console.log("Total Makespan:", schedule.timing?.makespan);
console.log("Critical Path:", schedule.timing?.criticalPath);
console.log("Provably Optimal:", schedule.timing?.provablyOptimal);