Skip to content

Commit f01906e

Browse files
PCfVWclaude
andcommitted
chore: Update all files to v2.3.0 with Go as 5th implementation
- Update version numbers across all READMEs (C++, Go, Rust, Zig, TypeScript) - Update Rust Cargo.toml and Cargo.lock to 2.3.0 - Update TypeScript package.json and source file @Version comments - Regenerate TypeScript package-lock.json files - Fix "four implementations" → "five implementations" in C++ header - Add Go section to INSTALL.md with installation and usage examples - Add Go column to cross-language method compatibility table - Update version compatibility matrix with v2.3.0 row and Go column - Add Go to building from source and error handling sections - Update ROADMAP.md to mark v2.3.0 Go milestone as complete 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent bccf951 commit f01906e

16 files changed

Lines changed: 149 additions & 66 deletions

File tree

Cpp/PriorityQueue.h

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,29 @@
1010
///
1111
/// This file is divided as follows:
1212
/// - File History (Line 19)
13-
/// - Inclusion of files (Line 123)
14-
/// - Namespace declaration (Line 136)
15-
/// - Class declaration (Line 145)
13+
/// - Inclusion of files (Line 143)
14+
/// - Namespace declaration (Line 156)
15+
/// - Class declaration (Line 165)
1616
///
17-
/// - End of file (line 415)
17+
/// - End of file (line 435)
1818
///
1919
/// =================================================================================================================== File history
2020
///
21-
/// [Author, Created, Last Modification] = [Eric JACOPIN, 2023/07/29, 2025/12/25]
22-
/// Version: 2.2.0
21+
/// [Author, Created, Last Modification] = [Eric JACOPIN, 2023/07/29, 2025/12/27]
22+
/// Version: 2.3.0
23+
///
24+
/// [v2.3.0] Go Implementation Release -------------------------------------------------------------------------------- 2025/12/27
25+
/// - Added complete Go implementation with full API parity (fifth language)
26+
/// - Go generics support: PriorityQueue[T any, K comparable] with Comparator and KeyExtractor
27+
/// - Go Dijkstra example demonstrating d-heap usage in examples/dijkstra/Go/
28+
/// - Comparator utilities: MinBy(), MaxBy() factory functions and pre-built comparators
29+
/// - Bulk operations: InsertMany(), PopMany() with Floyd's O(n) heapify algorithm
30+
/// - Cross-language aliases: Snake_case method aliases (Is_empty(), Increase_priority(), etc.)
31+
/// - Go workspace configuration with go.work for multi-module development
32+
/// - 47 test cases covering all functionality in Go implementation
33+
/// - All five implementations now maintain synchronized version numbers and API parity
34+
/// - Updated Rust package name to `d-ary-heap` for clarity and consistency
35+
/// - Standardized Rust library name to `d_ary_heap` throughout the codebase
2336
///
2437
/// [v2.2.0] Examples Infrastructure + TypeScript Dijkstra Release ---------------------------------------------------- 2025/12/26
2538
/// - Added examples/dijkstra/ infrastructure with Network Flows textbook example (Figure 4.7, page 110)
@@ -53,7 +66,7 @@
5366
/// - Added peek() alias and initCapacity() methods in Zig for API completeness
5467
/// - All four implementations maintain synchronized version numbers and API parity
5568
///
56-
/// [v1.1.0] Enhanced Release - Three-Language Implementation ---------------------------------------------------------- 2025/09/26
69+
/// [v1.1.0] Enhanced Release - Three-Language Implementation --------------------------------------------------------- 2025/09/26
5770
/// - Complete Zig implementation added with full API parity
5871
/// - All three languages (C++, Rust, Zig) now provide identical functionality
5972
/// - Enhanced documentation with cross-language comparison and usage guides
@@ -66,7 +79,7 @@
6679
/// - Cross-language API parity with Rust implementation
6780
/// - Professional documentation with usage examples and design explanations
6881
///
69-
/// [DEV 5] Cross-Language API Consistency --------------------------------------------------------------------------- 2025/09/25
82+
/// [DEV 5] Cross-Language API Consistency ---------------------------------------------------------------------------- 2025/09/25
7083
/// - Cross-language API methods added for consistency across C++, Rust, Zig, and TypeScript:
7184
/// - size() -> len() (unified across all languages)
7285
/// - empty() -> is_empty() (C++/Rust snake_case, Zig/TypeScript camelCase as isEmpty())

Cpp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![C++17](https://img.shields.io/badge/C%2B%2B-17-blue.svg)
22
![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-green.svg)
33

4-
# d-Heap Priority Queue (C++17) v2.2.0
4+
# d-Heap Priority Queue (C++17) v2.3.0
55

66
This is a generic d-ary heap priority queue supporting both min-queue and max-queue behavior through a comparator.
77

Go/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,4 +293,4 @@ cd Go && go test -bench=. ./src/...
293293

294294
## License
295295

296-
Apache License 2.0 - See [LICENSE](../LICENSE) for details.
296+
Apache License 2.0 - See [LICENSE](https://github.com/PCfVW/d-Heap-priority-queue/blob/master/LICENSE) for details.

INSTALL.md

Lines changed: 91 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,64 @@
11
# Installation Guide
22

3+
## Go Installation
4+
5+
### Prerequisites
6+
- **Go 1.21+** (for generics support)
7+
8+
### Install
9+
10+
```bash
11+
go get github.com/PCfVW/d-Heap-priority-queue/Go/src@v2.3.0
12+
```
13+
14+
### Usage
15+
16+
```go
17+
package main
18+
19+
import (
20+
"fmt"
21+
dheap "github.com/PCfVW/d-Heap-priority-queue/Go/src"
22+
)
23+
24+
type Task struct {
25+
ID string
26+
Priority int
27+
}
28+
29+
func main() {
30+
pq := dheap.New(dheap.Options[Task, string]{
31+
D: 4,
32+
Comparator: dheap.MinBy(func(t Task) int { return t.Priority }),
33+
KeyExtractor: func(t Task) string { return t.ID },
34+
})
35+
36+
pq.Insert(Task{ID: "task1", Priority: 10})
37+
pq.Insert(Task{ID: "task2", Priority: 5})
38+
39+
top, _ := pq.Front()
40+
fmt.Printf("Top: %s\n", top.ID) // task2
41+
}
42+
```
43+
44+
### Cross-Language Compatibility
45+
46+
Go provides both PascalCase (primary) and snake_case (compatibility) methods:
47+
48+
```go
49+
// Primary Go style
50+
pq.IsEmpty()
51+
pq.IncreasePriority(item)
52+
pq.String()
53+
54+
// Cross-language compatibility aliases
55+
pq.Is_empty()
56+
pq.Increase_priority(item)
57+
pq.To_string()
58+
```
59+
60+
---
61+
362
## TypeScript Installation
463

564
### Prerequisites
@@ -68,7 +127,7 @@ pq.to_string()
68127
.version = "0.1.0",
69128
.dependencies = .{
70129
.d_heap = .{
71-
.url = "https://github.com/your-username/priority-queues/archive/refs/tags/v2.2.0.tar.gz",
130+
.url = "https://github.com/PCfVW/priority-queues/archive/refs/tags/v2.3.0.tar.gz",
72131
.hash = "1220abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
73132
},
74133
},
@@ -136,7 +195,7 @@ pub fn main() !void {
136195
}
137196
```
138197

139-
### Cross-Language Compatibility (v2.2.0+)
198+
### Cross-Language Compatibility (v2.3.0+)
140199

141200
Zig provides both camelCase (primary) and snake_case (compatibility) methods:
142201

@@ -146,10 +205,9 @@ heap.isEmpty()
146205
heap.increasePriority(item)
147206
heap.toString()
148207
149-
// Cross-language compatibility aliases
208+
// Cross-language compatibility aliases
150209
heap.to_string() // Available in v2.2.0+
151210
```
152-
```
153211

154212
### Custom Item Types
155213

@@ -235,10 +293,10 @@ int main() {
235293
```toml
236294
[dependencies]
237295
# If published to crates.io (not recommended based on analysis)
238-
# rust_priority_queue = "2.2.0"
296+
# rust_priority_queue = "2.3.0"
239297

240298
# Or use git dependency
241-
rust_priority_queue = { git = "https://github.com/your-username/priority-queues", tag = "v2.2.0" }
299+
rust_priority_queue = { git = "https://github.com/PCfVW/priority-queues", tag = "v2.3.0" }
242300
```
243301

244302
### Usage
@@ -260,26 +318,36 @@ fn main() {
260318

261319
Different languages follow their respective naming conventions:
262320

263-
| Function | C++ | Rust | Zig | TypeScript |
264-
|----------|-----|------|-----|------------|
265-
| **Check Empty** | `is_empty()` | `is_empty()` | `isEmpty()` | `isEmpty()` |
266-
| **Increase Priority** | `increase_priority()` | `increase_priority()` | `increasePriority()` | `increasePriority()` |
267-
| **String Output** | `to_string()` | `to_string()` | `toString()` / `to_string()` | `toString()` / `to_string()` |
321+
| Function | C++ | Go | Rust | Zig | TypeScript |
322+
|----------|-----|-----|------|-----|------------|
323+
| **Check Empty** | `is_empty()` | `IsEmpty()` | `is_empty()` | `isEmpty()` | `isEmpty()` |
324+
| **Increase Priority** | `increase_priority()` | `IncreasePriority()` | `increase_priority()` | `increasePriority()` | `increasePriority()` |
325+
| **String Output** | `to_string()` | `String()` | `to_string()` | `toString()` / `to_string()` | `toString()` / `to_string()` |
268326

269-
### Compatibility Features (v2.2.0+)
327+
### Compatibility Features (v2.3.0+)
328+
- **Go**: Provides snake_case aliases (`Is_empty()`, `To_string()`) for cross-language consistency
270329
- **Zig**: Added `to_string()` alias for cross-language consistency
271330
- **TypeScript**: Provides complete snake_case aliases for all camelCase methods
272-
- **Error Handling**: Each language uses idiomatic error handling (assertions, panics, error unions, exceptions)
331+
- **Error Handling**: Each language uses idiomatic error handling (assertions, panics, error unions, exceptions, ok booleans)
273332

274333
## Building from Source
275334

276335
### Clone the repository
277336

278337
```bash
279-
git clone https://github.com/your-username/priority-queues.git
338+
git clone https://github.com/PCfVW/priority-queues.git
280339
cd priority-queues
281340
```
282341

342+
### Go
343+
344+
```bash
345+
cd Go
346+
go build ./... # Build all packages
347+
go test ./... # Run tests
348+
go run examples/dijkstra/Go/main.go # Run Dijkstra example
349+
```
350+
283351
### Zig
284352

285353
```bash
@@ -342,17 +410,18 @@ error: hash mismatch: expected 1220abc..., found 1220def...
342410
Copy the "found" hash to your `build.zig.zon`.
343411

344412
### Zig Version Compatibility
345-
- **v2.2.0+**: Requires Zig 0.15.2+
346-
- **v2.0.0-v2.1.1**: Requires Zig 0.15.2+
413+
- **v2.3.0+**: Requires Zig 0.15.2+
414+
- **v2.0.0-v2.2.0**: Requires Zig 0.15.2+
347415
- **v1.x**: For older Zig versions, use v1.1.0
348416

349417
### Version Compatibility Matrix
350418

351-
| Package Version | Zig | C++ | Rust | TypeScript | Node.js |
352-
|----------------|-----|-----|------|------------|---------|
353-
| **v2.2.0** | 0.15.2+ | C++17+ | 2021+ | 5.0+ | 18+ |
354-
| **v2.1.1** | 0.15.2+ | C++17+ | 2021+ | 5.0+ | 18+ |
355-
| **v2.0.0** | 0.15.2+ | C++17+ | 2021+ | N/A | N/A |
419+
| Package Version | Go | Zig | C++ | Rust | TypeScript | Node.js |
420+
|----------------|-----|-----|-----|------|------------|---------|
421+
| **v2.3.0** | 1.21+ | 0.15.2+ | C++17+ | 2021+ | 5.0+ | 18+ |
422+
| **v2.2.0** | N/A | 0.15.2+ | C++17+ | 2021+ | 5.0+ | 18+ |
423+
| **v2.1.1** | N/A | 0.15.2+ | C++17+ | 2021+ | 5.0+ | 18+ |
424+
| **v2.0.0** | N/A | 0.15.2+ | C++17+ | 2021+ | N/A | N/A |
356425

357426
### Build Issues
358427
- Ensure you have the correct compiler versions (see compatibility matrix above)
@@ -365,6 +434,7 @@ Copy the "found" hash to your `build.zig.zon`.
365434
Each language handles errors idiomatically:
366435

367436
- **C++**: Assertions (`assert()`) - check conditions before calling methods
437+
- **Go**: Ok booleans - use `Peek()` for safe access, errors returned as second value
368438
- **Rust**: Panics with messages - use `peek()` for safe access
369439
- **Zig**: Error unions (`!void`) - handle with `try` or explicit checking
370440
- **TypeScript**: Exceptions - use try-catch or `peek()` for safe access

ROADMAP.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,31 @@ Each milestone follows a deliberate sequence:
1414

1515
## Current Status
1616

17-
**v2.2.0** — Core implementations complete for C++, Rust, Zig, and TypeScript.
17+
**v2.3.0** — Core implementations complete for C++, Go, Rust, Zig, and TypeScript.
1818

1919
---
2020

21-
## v2.2.0 — Examples Infrastructure + TypeScript Dijkstra
21+
## v2.3.0 — Go Implementation ✅
22+
23+
> *Why Go? Why now?*
24+
25+
Research revealed the only existing Go d-ary heap library lacks `decrease_priority` and O(1) item lookup—the very features that make d-ary heaps useful for graph algorithms.
26+
27+
Adding Go after the TypeScript example (rather than before) means:
28+
- **The example pattern exists** — Dijkstra structure is already defined
29+
- **Architecture is validated**`go.work` setup tested with a real use case
30+
- **Different audience reached** — Go developers ≠ TypeScript developers
31+
32+
### Deliverables
33+
34+
- [x] `Go/` — Full implementation with API parity
35+
- [x] `go.work` — Workspace configuration for local development
36+
- [x] `examples/dijkstra/Go/` — Dijkstra implementation
37+
- [ ] Published on [pkg.go.dev](https://pkg.go.dev)
38+
39+
---
40+
41+
## v2.2.0 — Examples Infrastructure + TypeScript Dijkstra ✅
2242

2343
> *Why start here?*
2444
@@ -39,26 +59,6 @@ Starting with TypeScript enables:
3959

4060
---
4161

42-
## v2.3.0 — Go Implementation
43-
44-
> *Why Go? Why now?*
45-
46-
Research revealed the only existing Go d-ary heap library lacks `decrease_priority` and O(1) item lookup—the very features that make d-ary heaps useful for graph algorithms.
47-
48-
Adding Go after the TypeScript example (rather than before) means:
49-
- **The example pattern exists** — Dijkstra structure is already defined
50-
- **Architecture is validated**`go.work` setup tested with a real use case
51-
- **Different audience reached** — Go developers ≠ TypeScript developers
52-
53-
### Deliverables
54-
55-
- [ ] `Go/` — Full implementation with API parity
56-
- [ ] `go.work` — Workspace configuration for local development
57-
- [ ] `examples/dijkstra/Go/` — Dijkstra implementation
58-
- [ ] Published on [pkg.go.dev](https://pkg.go.dev)
59-
60-
---
61-
6262
## v2.4.0 — Complete Dijkstra Examples
6363

6464
> *Why wait for the other languages?*

Rust/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "d-ary-heap"
3-
version = "2.2.0"
3+
version = "2.3.0"
44
edition = "2021"
55
authors = ["Eric Jacopin"]
66
license = "Apache-2.0"

Rust/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![crates.io](https://img.shields.io/crates/v/d-ary-heap.svg)
44
![docs.rs](https://docs.rs/d-ary-heap/badge.svg)
55

6-
# d-ary Heap Priority Queue (Rust) v2.2.0
6+
# d-ary Heap Priority Queue (Rust) v2.3.0
77

88
**Wikipedia-standard d-ary heap implementation** with O(1) item lookup and configurable arity.
99

@@ -25,7 +25,7 @@ Add to your `Cargo.toml`:
2525

2626
```toml
2727
[dependencies]
28-
d-ary-heap = "2.2.0"
28+
d-ary-heap = "2.3.0"
2929
```
3030

3131
## Quick Start

TypeScript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue.svg)
22
![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-green.svg)
33

4-
# d-Heap Priority Queue (TypeScript) v2.2.0
4+
# d-Heap Priority Queue (TypeScript) v2.3.0
55

66
A high-performance, generic d-ary heap priority queue with O(1) item lookup, supporting both min-heap and max-heap behavior.
77

TypeScript/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)