effect-graph

Builds, traverses, and analyzes immutable graphs using Effect's Graph module in TypeScript.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-graph-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-graph
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-graph
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-graph-lambdasolver2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect.

What problem does it solve? Modeling dependencies, task ordering, reachability, and routing in TypeScript requires correct graph construction, cycle detection, and shortest-path logic, which is error-prone to implement by hand. This Skill provides expert guidance for Effect v4's Graph module so you can build immutable directed and undirected graphs and run proven algorithms over them. ## Core Features & Use Cases - Graph Construction & Mutation: Create directed or undirected graphs with scoped mutation via Graph.mutate, addNode, addEdge, and bulk map/filter transforms. - Traversal & Structure Analysis: Run lazy DFS, BFS, postorder, and topological walkers, plus isAcyclic, stronglyConnectedComponents, connectedComponents, and isBipartite checks. - Shortest Paths & Visualization: Compute routes with dijkstra, astar, bellmanFord, and floydWarshall, and export diagrams to GraphViz DOT or Mermaid. - Use Case: Model a build pipeline as a DAG, detect dependency cycles via stronglyConnectedComponents, derive execution order with topo, and render the pipeline as a Mermaid diagram. ## Quick Start Use the effect-graph skill to build a directed task dependency graph in Effect TypeScript, detect cycles, and produce a topological execution order.

Frequently Asked Questions about effect-graph

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create and modify a graph with Effect's Graph module?

Create graphs with Graph.directed or Graph.undirected, passing an optional mutation callback. All writes happen inside a mutation scope using Graph.mutate with addNode and addEdge, which returns a new immutable graph while the original stays unchanged.

How do I topologically sort tasks and detect dependency cycles in TypeScript?

Use Graph.topo for Kahn's algorithm topological ordering and Graph.isAcyclic to guard against cycles. For diagnosis, Graph.stronglyConnectedComponents returns components where any SCC with more than one node is a dependency cycle.

Does Effect Graph support shortest path algorithms with negative weights?

Yes, Graph.bellmanFord handles negative weights and returns Option.none() for negative cycles. Graph.dijkstra and Graph.astar require non-negative weights and throw GraphError if any edge in the graph has a negative or NaN cost.

Why does Graph.topo throw a GraphError?

Graph.topo throws GraphError when called on an undirected or cyclic graph, or when an initials entry has incoming edges. Guard cyclic graphs with Graph.isAcyclic first and ensure initials are zero in-degree nodes.

Can I export an Effect graph to Mermaid or GraphViz diagrams?

Yes, Graph.toMermaid and Graph.toGraphViz export directed and undirected graphs to diagram strings. Both accept optional node and edge label functions, and Mermaid supports direction and node shape options.

Why do DFS and BFS traversals return nothing in Effect Graph?

Traversals do not default to visiting all nodes; omitting the start array yields an empty iterator. Seed dfs or bfs with explicit start node indices, using multiple starts to cover disconnected components.