Skip to content

Commit 4cbd558

Browse files
committed
Update changelog and version
1 parent 1c35878 commit 4cbd558

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

CHANGELOG.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## Unreleased
8+
## 5.1.0 - Unreleased
99

1010
### Added
1111

@@ -32,6 +32,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
- Both algorithms run in O(V + E) time complexity
3333
- See module documentation for comparison with existing SCC algorithms
3434

35+
- **Enhanced DOT Rendering** (`yog/render/dot`): Major improvements to Graphviz export functionality:
36+
- **Generic Data Types**: `DotOptions` is now generic over node data `n` and edge data `e`, allowing it to work with any graph types without manual conversion
37+
- Use `default_dot_options()` for `String` edge data (backward compatible)
38+
- Use `default_dot_options_with_edge_formatter(fn(e) -> String)` for custom edge types (e.g., `Int`, `Float`, custom records)
39+
- Use `default_dot_options_with()` for full control over both node and edge labeling
40+
- **Per-Element Styling**: New callback functions for fine-grained visual control:
41+
- `node_attributes: fn(NodeId, n) -> List(#(String, String))` - Set custom DOT attributes per node (e.g., `[#("fillcolor", "green"), #("shape", "diamond")]`)
42+
- `edge_attributes: fn(NodeId, NodeId, e) -> List(#(String, String))` - Set custom DOT attributes per edge (e.g., `[#("color", "red"), #("penwidth", "2")]`)
43+
- Custom attributes override highlighting and default styles
44+
- **Subgraphs and Clusters**: New `Subgraph` type for visual node grouping:
45+
- Create visual clusters with `Subgraph(name: "cluster_0", label: Some("Group A"), node_ids: [1, 2, 3], ...)`
46+
- Supports all Graphviz subgraph attributes: `style`, `fillcolor`, `color`
47+
- Use `cluster_` prefix in name for bounded rectangle visualization
48+
- Improved attribute formatting with consistent `key="value"` syntax
49+
- **Example**:
50+
51+
```gleam
52+
let options = DotOptions(
53+
..dot.default_dot_options_with_edge_formatter(int.to_string),
54+
node_attributes: fn(id, _) {
55+
case id == start_node { True -> [#("fillcolor", "green")] False -> [] }
56+
},
57+
subgraphs: Some([Subgraph(name: "cluster_a", label: Some("Module A"), node_ids: [1, 2])]),
58+
)
59+
let dot_string = dot.to_dot(my_graph, options)
60+
```
61+
3562
### Changed
3663
3764
- **Consistent Parameter Labels**: Added descriptive labels to all semiring and algorithm parameters across pathfinding, centrality, health, and community detection modules for improved API consistency and self-documentation:

gleam.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "yog"
2-
version = "5.0.0"
2+
version = "5.1.0"
33
targets = ["erlang", "javascript"]
44
description = "A comprehensive graph and pathfinding library for Gleam."
55
licences = ["Apache-2.0"]

0 commit comments

Comments
 (0)