Skip to content

Commit da6357b

Browse files
schicklingeffect-bot
authored andcommitted
feat: add Graph module with comprehensive graph data structure support (#5372)
1 parent 4c78251 commit da6357b

File tree

4 files changed

+6462
-0
lines changed

4 files changed

+6462
-0
lines changed

.changeset/add-graph-module.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
"effect": minor
3+
---
4+
5+
Add experimental Graph module with comprehensive graph data structure support
6+
7+
This experimental module provides:
8+
- Directed and undirected graph support
9+
- Immutable and mutable graph variants
10+
- Type-safe node and edge operations
11+
- Graph algorithms: DFS, BFS, shortest paths, cycle detection, etc.
12+
13+
Example usage:
14+
```typescript
15+
import { Graph } from "effect"
16+
17+
// Create a graph with mutations
18+
const graph = Graph.directed<string, number>((mutable) => {
19+
const nodeA = Graph.addNode(mutable, "Node A")
20+
const nodeB = Graph.addNode(mutable, "Node B")
21+
Graph.addEdge(mutable, nodeA, nodeB, 5)
22+
})
23+
24+
console.log(`Nodes: ${Graph.nodeCount(graph)}, Edges: ${Graph.edgeCount(graph)}`)
25+
```

0 commit comments

Comments
 (0)