| 1 | # Changelog |
| 2 | |
| 3 | All notable changes to this project will be documented in this file. |
| 4 | |
| 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project |
| 6 | adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 7 | |
| 8 | ## [0.23.0] - 2023-07-05 |
| 9 | |
| 10 | **Are you using graph? [Check out the graph user survey](https://forms.gle/MLKUZKMeCRxTfj4v9)** |
| 11 | |
| 12 | ### Added |
| 13 | * Added the `AllPathsBetween` function for computing all paths between two vertices. |
| 14 | |
| 15 | ## [0.22.3] - 2023-06-14 |
| 16 | |
| 17 | ### Changed |
| 18 | * Changed `StableTopologicalSort` to invoke the `less` function as few as possible, reducing comparisons. |
| 19 | * Changed `CreatesCycle` to use an optimized path if the default in-memory store is being used. |
| 20 | * Changed map allocations to use pre-defined memory sizes. |
| 21 | |
| 22 | ## [0.22.2] - 2023-06-06 |
| 23 | |
| 24 | ### Fixed |
| 25 | * Fixed the major performance issues of `StableTopologicalSort`. |
| 26 | |
| 27 | ## [0.22.1] - 2023-06-05 |
| 28 | |
| 29 | ### Fixed |
| 30 | * Fixed `TopologicalSort` to retain its original performance. |
| 31 | |
| 32 | ## [0.22.0] - 2023-05-24 |
| 33 | |
| 34 | ### Added |
| 35 | * Added the `StableTopologicalSort` function for deterministic topological orderings. |
| 36 | * Added the `VertexAttributes` functional option for setting an entire vertex attributes map. |
| 37 | |
| 38 | ## [0.21.0] - 2023-05-18 |
| 39 | |
| 40 | ### Added |
| 41 | * Added the `BFSWithDepth` function for performing a BFS with depth information. |
| 42 | |
| 43 | ### Fixed |
| 44 | * Fixed false positives of `ErrVertexHasEdges` when removing a vertex. |
| 45 | |
| 46 | ## [0.20.0] - 2023-05-01 |
| 47 | |
| 48 | **Release post: [graph Version 0.20 Is Out](https://dominikbraun.io/blog/graph-version-0.20-is-out/)** |
| 49 | |
| 50 | ### Added |
| 51 | * Added the `Graph.AddVerticesFrom` method for adding all vertices from another graph. |
| 52 | * Added the `Graph.AddEdgesFrom` method for adding all edges from another graph. |
| 53 | * Added the `Graph.Edges` method for obtaining all edges as a slice. |
| 54 | * Added the `Graph.UpdateEdge` method for updating the properties of an edge. |
| 55 | * Added the `Store.UpdateEdge` method for updating the properties of an edge. |
| 56 | * Added the `NewLike` function for creating a new graph that is "like" the given graph. |
| 57 | * Added the `EdgeAttributes` functional option for setting an entire edge attributes map. |
| 58 | |
| 59 | ### Changed |
| 60 | * Changed `Graph.Clone` to use the built-in in-memory store for storing vertices and edges for cloned graphs. |
| 61 | |
| 62 | ## [0.19.0] - 2023-04-23 |
| 63 | |
| 64 | ### Added |
| 65 | * Added the `MinimumSpanningTree` function for finding a minimum spanning tree. |
| 66 | * Added the `MaximumSpanningTree` function for finding a maximum spanning tree. |
| 67 | |
| 68 | ## [0.18.0] - 2023-04-16 |
| 69 | |
| 70 | ### Added |
| 71 | * Added the `Graph.RemoveVertex` method for removing a vertex. |
| 72 | * Added the `Store.RemoveVertex` method for removing a vertex. |
| 73 | * Added the `ErrVertexHasEdges` error instance. |
| 74 | * Added the `Union` function for combining two graphs into one. |
| 75 | |
| 76 | ## [0.17.0] - 2023-04-12 |
| 77 | |
| 78 | ### Added |
| 79 | * Added the `draw.GraphAttributes` functional option for `draw.DOT` for rendering graph attributes. |
| 80 | |
| 81 | ### Changed |
| 82 | * Changed the library's GoDoc documentation. |
| 83 | |
| 84 | ## [0.16.2] - 2023-03-27 |
| 85 | |
| 86 | ### Fixed |
| 87 | * Fixed `ShortestPath` for an edge case. |
| 88 | |
| 89 | ## [0.16.1] - 2023-03-06 |
| 90 | |
| 91 | ### Fixed |
| 92 | * Fixed `TransitiveReduction` not to incorrectly report cycles. |
| 93 | |
| 94 | ## [0.16.0] - 2023-03-01 |
| 95 | |
| 96 | **This release contains breaking changes of the public API (see "Changed").** |
| 97 | |
| 98 | ### Added |
| 99 | * Added the `Store` interface, introducing support for custom storage implementations. |
| 100 | * Added the `NewWithStore` function for explicitly initializing a graph with a `Store` instance. |
| 101 | * Added the `EdgeData` functional option that can be used with `AddEdge`, introducing support for arbitrary data. |
| 102 | * Added the `Data` field to `EdgeProperties` for retrieving data added using `EdgeData`. |
| 103 | |
| 104 | ### Changed |
| 105 | * Changed `Order` to additionally return an error instance (breaking change). |
| 106 | * Changed `Size` to additionally return an error instance (breaking change). |
| 107 | |
| 108 | ## [0.15.1] - 2023-01-18 |
| 109 | |
| 110 | ### Changed |
| 111 | * Changed `ShortestPath` to return `ErrTargetNotReachable` if the target vertex is not reachable. |
| 112 | |
| 113 | ### Fixed |
| 114 | * Fixed `ShortestPath` to return correct results for large unweighted graphs. |
| 115 | |
| 116 | ## [0.15.0] - 2022-11-25 |
| 117 | |
| 118 | ### Added |
| 119 | * Added the `ErrVertexAlreadyExists` error instance. Use `errors.Is` to check for this instance. |
| 120 | * Added the `ErrEdgeAlreadyExists` error instance. Use `errors.Is` to check for this instance. |
| 121 | * Added the `ErrEdgeCreatesCycle` error instance. Use `errors.Is` to check for this instance. |
| 122 | |
| 123 | ### Changed |
| 124 | * Changed `AddVertex` to return `ErrVertexAlreadyExists` if the vertex already exists. |
| 125 | * Changed `VertexWithProperties` to return `ErrVertexNotFound` if the vertex doesn't exist. |
| 126 | * Changed `AddEdge` to return `ErrVertexNotFound` if either vertex doesn't exist. |
| 127 | * Changed `AddEdge` to return `ErrEdgeAlreadyExists` if the edge already exists. |
| 128 | * Changed `AddEdge` to return `ErrEdgeCreatesCycle` if cycle prevention is active and the edge would create a cycle. |
| 129 | * Changed `Edge` to return `ErrEdgeNotFound` if the edge doesn't exist. |
| 130 | * Changed `RemoveEdge` to return the error instances returned by `Edge`. |
| 131 | |
| 132 | ## [0.14.0] - 2022-11-01 |
| 133 | |
| 134 | ### Added |
| 135 | * Added the `ErrVertexNotFound` error instance. |
| 136 | |
| 137 | ### Changed |
| 138 | * Changed `TopologicalSort` to fail at runtime when a cycle is detected. |
| 139 | * Changed `TransitiveReduction` to return the transitive reduction as a new graph and fail at runtime when a cycle is detected. |
| 140 | * Changed `Vertex` to return `ErrVertexNotFound` if the desired vertex couldn't be found. |
| 141 | |
| 142 | ## [0.13.0] - 2022-10-15 |
| 143 | |
| 144 | ### Added |
| 145 | * Added the `VertexProperties` type for storing vertex-related properties. |
| 146 | * Added the `VertexWithProperties` method for retrieving a vertex and its properties. |
| 147 | * Added the `VertexWeight` functional option that can be used for `AddVertex`. |
| 148 | * Added the `VertexAttribute` functional option that can be used for `AddVertex`. |
| 149 | * Added support for rendering vertices with attributes using `draw.DOT`. |
| 150 | |
| 151 | ### Changed |
| 152 | * Changed `AddVertex` to accept functional options. |
| 153 | * Renamed `PermitCycles` to `PreventCycles`. This seems to be the price to pay if English isn't a library author's native language. |
| 154 | |
| 155 | ### Fixed |
| 156 | * Fixed the behavior of `ShortestPath` when the target vertex is not reachable from one of the visited vertices. |
| 157 | |
| 158 | ## [0.12.0] - 2022-09-19 |
| 159 | |
| 160 | ### Added |
| 161 | * Added the `PermitCycles` option to explicitly prevent the creation of cycles. |
| 162 | |
| 163 | ### Changed |
| 164 | * Changed the `Acyclic` option to not implicitly impose cycle checks for operations like `AddEdge`. To prevent the creation of cycles, use `PermitCycles`. |
| 165 | * Changed `TopologicalSort` to only work for graphs created with `PermitCycles`. This is temporary. |
| 166 | * Changed `TransitiveReduction` to only work for graphs created with `PermitCycles`. This is temporary. |
| 167 | |
| 168 | ## [0.11.0] - 2022-09-15 |
| 169 | |
| 170 | ### Added |
| 171 | * Added the `Order` method for retrieving the number of vertices in the graph. |
| 172 | * Added the `Size` method for retrieving the number of edges in the graph. |
| 173 | |
| 174 | ### Changed |
| 175 | * Changed the `graph` logo. |
| 176 | * Changed an internal operation of `ShortestPath` from O(n) to O(log(n)) by implementing the priority queue as a binary heap. Note that the actual complexity might still be defined by `ShortestPath` itself. |
| 177 | |
| 178 | ### Fixed |
| 179 | * Fixed `draw.DOT` to work correctly with vertices that contain special characters and whitespaces. |
| 180 | |
| 181 | ## [0.10.0] - 2022-09-09 |
| 182 | |
| 183 | ### Added |
| 184 | * Added the `PredecessorMap` method for obtaining a map with all predecessors of each vertex. |
| 185 | * Added the `RemoveEdge` method for removing the edge between two vertices. |
| 186 | * Added the `Clone` method for retrieving a deep copy of the graph. |
| 187 | * Added the `TopologicalSort` function for obtaining the topological order of the vertices in the graph. |
| 188 | * Added the `TransitiveReduction` function for transforming the graph into its transitive reduction. |
| 189 | |
| 190 | ### Changed |
| 191 | * Changed the `visit` function of `DFS` to accept a vertex hash instead of the vertex value (i.e. `K` instead of `T`). |
| 192 | * Changed the `visit` function of `BFS` to accept a vertex hash instead of the vertex value (i.e. `K` instead of `T`). |
| 193 | |
| 194 | ### Removed |
| 195 | * Removed the `Predecessors` function. Use `PredecessorMap` instead and look up the respective vertex. |
| 196 | |
| 197 | ## [0.9.0] - 2022-08-17 |
| 198 | |
| 199 | ### Added |
| 200 | * Added the `Graph.AddVertex` method for adding a vertex. This replaces `Graph.Vertex`. |
| 201 | * Added the `Graph.AddEdge` method for creating an edge. This replaces `Graph.Edge`. |
| 202 | * Added the `Graph.Vertex` method for retrieving a vertex by its hash. This is not to be confused with the old `Graph.Vertex` function for adding vertices that got replaced with `Graph.AddVertex`. |
| 203 | * Added the `Graph.Edge` method for retrieving an edge. This is not to be confused with the old `Graph.Edge` function for creating an edge that got replaced with `Graph.AddEdge`. |
| 204 | * Added the `Graph.Predecessors` function for retrieving a vertex' predecessors. |
| 205 | * Added the `DFS` function. |
| 206 | * Added the `BFS` function. |
| 207 | * Added the `CreatesCycle` function. |
| 208 | * Added the `StronglyConnectedComponents` function. |
| 209 | * Added the `ShortestPath` function. |
| 210 | * Added the `ErrEdgeNotFound` error indicating that a desired edge could not be found. |
| 211 | |
| 212 | ### Removed |
| 213 | * Removed the `Graph.EdgeByHashes` method. Use `Graph.AddEdge` instead. |
| 214 | * Removed the `Graph.GetEdgeByHashes` method. Use `Graph.Edge` instead. |
| 215 | * Removed the `Graph.DegreeByHash` method. Use `Graph.Degree` instead. |
| 216 | * Removed the `Graph.Degree` method. |
| 217 | * Removed the `Graph.DFS` and `Graph.DFSByHash` methods. Use `DFS` instead. |
| 218 | * Removed the `Graph.BFS` and `Graph.BFSByHash` methods. Use `BFS` instead. |
| 219 | * Removed the `Graph.CreatesCycle` and `Graph.CreatesCycleByHashes` methods. Use `CreatesCycle` instead. |
| 220 | * Removed the `Graph.StronglyConnectedComponents` method. Use `StronglyConnectedComponents` instead. |
| 221 | * Removed the `Graph.ShortestPath` and `Graph.ShortestPathByHash` methods. Use `ShortestPath` instead. |
| 222 | |
| 223 | ## [0.8.0] - 2022-08-01 |
| 224 | |
| 225 | ### Added |
| 226 | * Added the `EdgeWeight` and `EdgeAttribute` functional options. |
| 227 | * Added the `Properties` field to `Edge`. |
| 228 | |
| 229 | ### Changed |
| 230 | * Changed `Edge` to accept a variadic `options` parameter. |
| 231 | * Changed `EdgeByHashes` to accept a variadic `options` parameter. |
| 232 | * Renamed `draw.Graph` to `draw.DOT` for more clarity regarding the rendering format. |
| 233 | |
| 234 | ### Removed |
| 235 | * Removed the `WeightedEdge` function. Use `Edge` with the `EdgeWeight` functional option instead. |
| 236 | * Removed the `WeightedEdgeByHashes` function. Use `EdgeByHashes` with the `EdgeWeight` functional option instead. |
| 237 | |
| 238 | ### Fixed |
| 239 | * Fixed missing edge attributes when drawing a graph using `draw.DOT`. |
| 240 | |
| 241 | ## [0.7.0] - 2022-07-26 |
| 242 | |
| 243 | ### Added |
| 244 | * Added `draw` package for graph visualization using DOT-compatible renderers. |
| 245 | * Added `Traits` function for retrieving the graph's traits. |
| 246 | |
| 247 | ## [0.6.0] - 2022-07-22 |
| 248 | |
| 249 | ### Added |
| 250 | * Added `AdjacencyMap` function for retrieving an adjancency map for all vertices. |
| 251 | |
| 252 | ### Removed |
| 253 | * Removed the `AdjacencyList` function. |
| 254 | |
| 255 | ## [0.5.0] - 2022-07-21 |
| 256 | |
| 257 | ### Added |
| 258 | * Added `AdjacencyList` function for retrieving an adjacency list for all vertices. |
| 259 | |
| 260 | ### Changed |
| 261 | * Updated the examples in the documentation. |
| 262 | |
| 263 | ## [0.4.0] - 2022-07-01 |
| 264 | |
| 265 | ### Added |
| 266 | * Added `ShortestPath` function for computing shortest paths. |
| 267 | |
| 268 | ### Changed |
| 269 | * Changed the term "properties" to "traits" in the code and documentation. |
| 270 | * Don't traverse all vertices in disconnected graphs by design. |
| 271 | |
| 272 | ## [0.3.0] - 2022-06-27 |
| 273 | |
| 274 | ### Added |
| 275 | * Added `StronglyConnectedComponents` function for detecting SCCs. |
| 276 | * Added various images to usage examples. |
| 277 | |
| 278 | ## [0.2.0] - 2022-06-20 |
| 279 | |
| 280 | ### Added |
| 281 | * Added `Degree` and `DegreeByHash` functions for determining vertex degrees. |
| 282 | * Added cycle checks when adding an edge using the `Edge` functions. |
| 283 | |
| 284 | ## [0.1.0] - 2022-06-19 |
| 285 | |
| 286 | ### Added |
| 287 | * Added `CreatesCycle` and `CreatesCycleByHashes` functions for predicting cycles. |
| 288 | |
| 289 | ## [0.1.0-beta] - 2022-06-17 |
| 290 | |
| 291 | ### Changed |
| 292 | * Introduced dedicated types for directed and undirected graphs, making `Graph[K, T]` an interface. |
| 293 | |
| 294 | ## [0.1.0-alpha] - 2022-06-13 |
| 295 | |
| 296 | ### Added |
| 297 | * Introduced core types and methods. |