From 8cc43b6259090f8dff0c9c68bc97d49039c0b09c Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Sat, 29 Aug 2026 20:15:47 -0400 Subject: [PATCH 1/9] Show iteration and length in the edges docstring Adds iteration and `length` examples to the `edges` docstring, the two things a caller most often does with an edge iterator and the two the examples left out. Also names the return type as `Graphs.AbstractEdgeIter` and says which concrete type it currently is, so neither reads as a promise the other way. --- src/abstractnamedgraph.jl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/abstractnamedgraph.jl b/src/abstractnamedgraph.jl index 9e02b02..a547827 100644 --- a/src/abstractnamedgraph.jl +++ b/src/abstractnamedgraph.jl @@ -266,13 +266,16 @@ function decoded_edge(graph::AbstractNamedGraph, encoded_edge::AbstractEdge) end """ - edges(graph::AbstractNamedGraph) -> AbstractEdgeIter + edges(graph::AbstractNamedGraph) -> Graphs.AbstractEdgeIter -A Graphs.jl `AbstractEdgeIter` over the edges of `graph`, yielding each edge +A `Graphs.AbstractEdgeIter` over the edges of `graph`, yielding each edge exactly once, with membership testing (`in`) matching `has_edge` (in particular, on undirected graphs an edge and its reverse are both members while iteration yields each edge once). The iteration order is unspecified. +Only the `Graphs.AbstractEdgeIter` interface is promised. The concrete type is +currently `NamedGraphs.NamedEdgeIter`, which may change. + The output is a live view of the graph: do not rely on it across mutations of the graph. @@ -285,6 +288,15 @@ julia> using NamedGraphs: NamedEdge, NamedGraph julia> g = NamedGraph(path_graph(3), ["a", "b", "c"]); +julia> for e in edges(g) + println(e) + end +"a" => "b" +"b" => "c" + +julia> length(edges(g)) +2 + julia> collect(edges(g)) 2-element Vector{NamedEdge{String}}: "a" => "b" From 694e5fca775fab265317b972dc3af70946c3284b Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 09:19:41 -0400 Subject: [PATCH 2/9] Reorganize the 0.14 changelog and say what the edge iterator guarantees The changelog now leads with what upgrading actually runs into and the errors to look for, including the cases that give a wrong result instead of an error. It was a flat list in merge order, which put the changes that cost nothing next to the ones that cost the most. The `edges` docstring says what the iterator supports rather than pointing at `Graphs.AbstractEdgeIter`, which is a bare abstract type with no contract of its own. --- docs/src/changelog.md | 270 +++++++++++++++++++++++++++----------- src/abstractnamedgraph.jl | 19 ++- 2 files changed, 204 insertions(+), 85 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index c93e1a6..f8d6975 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -5,103 +5,210 @@ Reworks how named vertices and edges are translated to the integer vertices and edges used internally. -### Breaking changes - -- The "position graph" terminology is replaced with encode and decode - terminology. The overloads for implementing a new `AbstractNamedGraph` are - `encoded_graph(g)` (replaces `position_graph`, with a generic - `EncodedGraphView` fallback so a graph type does not need to store an - integer graph), `encoded_vertex(g, v)` (replaces `vertex_positions`), and - `decoded_vertex(g, c)` (replaces `ordered_vertices`). Codes are not stable - across mutation - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). -- The `OrdinalIndexing` submodule is removed, so `vertices(g)[4th]` becomes - `decoded_vertex(g, 4)` - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). -- `vertices(g::Named[Di]Graph)` outputs a - `Dictionaries.Indices` instead of the internal `OrderedIndices` type, which - is removed along with the `OrderedDictionaries` submodule. Other - `AbstractNamedGraph` types can output other `AbstractIndices` set views. - Vertices iterate in insertion order, which is stable under removals and - therefore no longer matches the integer codes after removals, so code that - aligns `vertices(g)` with results computed on the integer graph should - translate through `decoded_vertex` - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). -- `edges(g)` outputs a lazy iterator instead of a `Vector`, like - `edges(::SimpleGraph)` in Graphs.jl. Membership (`in`) matches `has_edge`, - and `==` between two edge iterators compares the edge sets. Code that - indexed into the output should `collect` it first - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +### Upgrading + +These are the changes that existing code actually runs into, ordered by how +often they came up when migrating the packages that depend on NamedGraphs. The +"Other breaking changes" section below has the rest. + +#### The submodules are gone + +`GraphsExtensions`, `Keys`, `SimilarType`, `GraphGenerators`, +`NamedGraphGenerators`, `OrdinalIndexing`, and `OrderedDictionaries` no longer +exist. `PartitionedGraphs` is the only remaining submodule. Their contents are +available directly from `NamedGraphs`, so an import like + +```julia +using NamedGraphs.GraphsExtensions: boundary_edges +using NamedGraphs.NamedGraphGenerators: named_grid +``` + +becomes + +```julia +using NamedGraphs: boundary_edges, named_grid +``` + +This is the most common change by volume and the least interesting: it fails +loudly at load with an `UndefVarError` naming the submodule, and the fix is to +delete the submodule from the path. Two cases need more than that: + +- The `Key` type is deleted rather than moved. Contraction sequences over + non-scalar vertices are built on it, so code that used it needs its own + equivalent, along with a `NamedGraphs.to_graph_index(graph, key::Key)` method + so the graph knows how to unwrap it. +- `vertices(g)[4th]` from `OrdinalIndexing` becomes `decoded_vertex(g, 4)`. + +([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183), +[#187](https://github.com/ITensor/NamedGraphs.jl/pull/187), +[#189](https://github.com/ITensor/NamedGraphs.jl/pull/189), +[#190](https://github.com/ITensor/NamedGraphs.jl/pull/190)) + +#### `edges(g)` returns a lazy iterator + +`edges(g)` now returns a `Graphs.AbstractEdgeIter` rather than a `Vector`, +matching `edges(::SimpleGraph)` in Graphs.jl. Membership (`in`) matches +`has_edge`, and `==` between two edge iterators compares the edge sets. + +Most of the resulting errors do not mention `edges`, so they are worth listing +by symptom: + +| what you wrote | what you get | +|---|---| +| `filter(f, edges(g))` | `MethodError: no method matching filter(::F, ::NamedGraphs.NamedEdgeIter{...})` | +| `findfirst(f, edges(g))` | `MethodError: no method matching keys(::NamedGraphs.NamedEdgeIter{...})` | +| `edges(g)[i]` | `MethodError: no method matching getindex(::NamedGraphs.NamedEdgeIter{...}, ::Int64)` | +| a `Vector{<:AbstractEdge}` argument defaulting to `edges(g)` | a `MethodError` naming a generated keyword-body function rather than the function you called | + +Adding `collect` at the call site fixes all of these. + +Plenty still works directly, so there is no need to `collect` defensively: +iteration, `length`, `first`, `in`, `==`, `issetequal`, `union`, `setdiff`, +broadcasting (`reverse.(edges(g))` gives a properly typed `Vector`), and +building a `Dictionary` or `Indices` from the result. + +**One case changes behavior instead of erroring.** `vcat` treats anything that +is not an `AbstractArray` as a single scalar element, so + +```julia +julia> vcat(edges(g), reverse.(edges(g))) +5-element Vector{Any}: + NamedEdge{Tuple{Int64, Int64}}[(1, 1) => (2, 1), (1, 1) => (1, 2), (2, 1) => (2, 2), (1, 2) => (2, 2)] + (2, 1) => (1, 1) + (1, 2) => (1, 1) + (2, 2) => (2, 1) + (2, 2) => (1, 2) +``` + +gives five elements on a four-edge graph, the first of which is the whole edge +list, where the intended result has eight. `collect` the first argument. + +**`edges(g)` is also a live view of the graph rather than a snapshot.** Holding +on to it across a mutation now sees the mutation: + +```julia +julia> es = edges(g); length(es) +4 + +julia> rem_edge!(g, first(es)); length(es) +3 +``` + +`collect` it first if you need the edges as they were. + +([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)) + +#### Vertex order and integer codes diverge after a removal + +`vertices(g::Named[Di]Graph)` outputs a `Dictionaries.Indices` instead of the +internal `OrderedIndices` type. Other `AbstractNamedGraph` types can output +other `AbstractIndices` set views. Indexing is by vertex name, not position. + +Vertices iterate in insertion order, which is stable under removals. The +integer codes are not: removing a vertex moves the last code into the freed +slot. In v0.13 those two orders were kept in agreement, and in v0.14 they part +company after the first removal: + +```julia +julia> g = NamedGraph(path_graph(5), ["a", "b", "c", "d", "e"]); rem_vertex!(g, "b"); + +julia> collect(vertices(g)) +4-element Vector{String}: + "a" + "c" + "d" + "e" + +julia> [decoded_vertex(g, code) for code in 1:nv(g)] +4-element Vector{String}: + "a" + "e" + "c" + "d" +``` + +Nothing errors here, so code that computes something on the integer graph and +then maps the result back with `collect(vertices(g))[code]` silently gets the +wrong vertex. Translate through `decoded_vertex(g, code)` instead. + +([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)) + +#### `encoded_graph` and friends replace the position graph + +The "position graph" terminology is replaced with encode and decode +terminology. The overloads for implementing a new `AbstractNamedGraph` are +`encoded_graph(g)` (replaces `position_graph`, with a generic `EncodedGraphView` +fallback so a graph type does not need to store an integer graph), +`encoded_vertex(g, v)` (replaces `vertex_positions`), and `decoded_vertex(g, c)` +(replaces `ordered_vertices`). Codes are not stable across mutation. + +This is not a symbol-level rename. `vertex_positions(g)` and +`ordered_vertices(g)` returned a whole mapping, while `encoded_vertex(g, v)` and +`decoded_vertex(g, c)` translate a single vertex, so a type that forwarded the +old three in a loop over function names has to write the new ones out as +separate methods. + +([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)) + +#### Mutators return `Bool` and counts + +`rem_vertex!`, `add_edge!`, and `rem_edge!` return `true` or `false` following +Graphs.jl, matching `add_vertex!`. Previously they returned the graph, and +`add_edge!`/`rem_edge!` threw for edges with vertices not in the graph, which +now returns `false`. + +The plural mutators `add_edges!`, `rem_edges!`, `add_vertices!`, and +`rem_vertices!` return the number of successful additions or removals, where +they previously returned the graph. `Bool` from the singular `Graphs.add_edge!` +is the one-element case of the same count, and `Graphs.add_vertices!` already +returned a count. `rem_quotientvertex!` and `rem_quotientedge!` likewise return +how many underlying vertices or edges went, so `0` means the quotient vertex or +edge was not there. + +This affects types that define these methods rather than code that calls them. +A type of that kind needs two things beyond the return value: a `has_vertex` +guard so that removing an absent vertex returns `false` instead of throwing, +and `Dictionaries.unset!` in place of `delete!` where a missing key would +otherwise throw. + +([#179](https://github.com/ITensor/NamedGraphs.jl/pull/179), +[#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)) + +### Other breaking changes + - `GenericNamedGraph{V, G}` is removed (it was not exported, so this only affects code that imported it explicitly). `NamedGraph{V}` and `NamedDiGraph{V}` are now separately defined concrete types, hardcoded to `SimpleGraph{Int}` and `SimpleDiGraph{Int}` underlying storage ([#179](https://github.com/ITensor/NamedGraphs.jl/pull/179)). -- `rem_vertex!`, `add_edge!`, and `rem_edge!` return `true` or `false` - following Graphs.jl, matching `add_vertex!`. Previously they returned the - graph on success, and `add_edge!`/`rem_edge!` threw for edges with vertices - not in the graph, which now returns `false` - ([#179](https://github.com/ITensor/NamedGraphs.jl/pull/179)). -- The plural mutators `add_edges!`, `rem_edges!`, `add_vertices!`, and - `rem_vertices!` return the number of successful additions or removals, where - they previously returned the graph. `Bool` from the singular `Graphs.add_edge!` - is the one-element case of the same count, and `Graphs.add_vertices!` already - returned a count. `rem_quotientvertex!` and `rem_quotientedge!` likewise return - how many underlying vertices or edges went, so `0` means the quotient vertex or - edge was not there ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). - `add_vertices!` and `rem_vertices!` are methods of the Graphs.jl functions of - those names rather than separate `NamedGraphs.GraphsExtensions` functions, and - are declared on `AbstractNamedGraph`. `NamedGraphs.GraphsExtensions.add_vertices!` - and `.rem_vertices!` no longer exist, so import them from `Graphs` instead. An - integer second argument is a vertex name here, not upstream's count of vertices - to append, since a named graph cannot invent names ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). -- The `Keys`, `SimilarType`, `GraphGenerators`, and `NamedGraphGenerators` - submodules are removed. The named graph generators (`named_grid`, - `named_path_graph`, and so on) and `similar_type` are accessible directly - from `NamedGraphs`, the simple graph generators `comb_tree` and - `binary_arborescence` move to `NamedGraphs.GraphsExtensions`, and the - unused `Key` type is deleted - ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). + those names rather than separate functions of NamedGraphs' own, and are + declared on `AbstractNamedGraph`. An integer second argument is a vertex name + here, not upstream's count of vertices to append, since a named graph cannot + invent names ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). +- Considerably more names are exported, where previously only the four graph and + edge types were, so `using NamedGraphs` can collide with names another package + exports ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). - The wrappers around Graphs.jl functions mirror the upstream positional signatures instead of taking `args...` or untyped arguments, so some argument - types that were previously accepted no longer are ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). + types that were previously accepted no longer are + ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). - `eccentricity(graph, x)` is always the eccentricity of the single vertex `x`. - The every-vertex form is `eccentricities` ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). + The every-vertex form is `eccentricities` + ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). - A `Vector{Bool}` passed to `induced_subgraph` is a list of vertex names, not a - mask over `1:nv(graph)` ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). -- `induced_subgraph` throws for vertices the graph does not have, where it - previously returned a graph built on them ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). + mask over `1:nv(graph)`, and `induced_subgraph` throws for vertices the graph + does not have, where it previously returned a graph built on them + ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). - `rename_vertices(edge, name_map)` is removed. Write - `rename_vertices(v -> name_map[v], edge)` ([#184](https://github.com/ITensor/NamedGraphs.jl/pull/184)). -- `rename_vertices`, `disjoint_union`, and `⊔` move from - `NamedGraphs.GraphsExtensions` to `NamedGraphs`, since they only work for - graphs whose vertices are names, while `GraphsExtensions` holds extensions - valid for any `Graphs.AbstractGraph` - ([#187](https://github.com/ITensor/NamedGraphs.jl/pull/187)). -- `add_vertex`, `add_vertices`, `rem_vertex`, `rem_vertices`, `add_edge`, - `add_edges`, `add_edges!`, `rem_edge`, `rem_edges`, `rem_edges!`, - `empty_graph`, `edgeless_graph`, `edge_subgraph`, `directed_graph`, - `undirected_graph`, `spanning_tree`, `spanning_forest`, `forest_cover`, and - `forest_cover_edge_sequence` move from `NamedGraphs.GraphsExtensions` to - `NamedGraphs` for the same reason, so - `using NamedGraphs.GraphsExtensions: add_edges!` becomes - `using NamedGraphs: add_edges!` - ([#189](https://github.com/ITensor/NamedGraphs.jl/pull/189)). -- Considerably more names are exported, where previously only the four graph and - edge types were, so `using NamedGraphs` can collide with names another package - exports. `NamedGraphs.GraphsExtensions` also exports its documented names now, - where it exported nothing, so `using NamedGraphs.GraphsExtensions` brings them - into scope ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). + `rename_vertices(v -> name_map[v], edge)` + ([#184](https://github.com/ITensor/NamedGraphs.jl/pull/184)). - The internal helpers behind the Graphs.jl wrappers are renamed from `namedgraph_f` to `f_namedgraph`, matching the suffix convention already used by `similar_namedgraph` and others. `AbstractNamedGraph` subtypes should now override these hooks rather than the Graphs.jl functions themselves, which means a subtype no longer needs its own `::Integer` disambiguator ([#187](https://github.com/ITensor/NamedGraphs.jl/pull/187)). -- The `GraphsExtensions` submodule is removed. Its contents are in `NamedGraphs` - directly, so `using NamedGraphs.GraphsExtensions: boundary_edges` becomes - `using NamedGraphs: boundary_edges` - ([#190](https://github.com/ITensor/NamedGraphs.jl/pull/190)). ### Non-breaking changes @@ -113,6 +220,9 @@ and edges used internally. [#187](https://github.com/ITensor/NamedGraphs.jl/pull/187)). Indexing a `QuotientView` by a collection of vertices or edges was broken the same way and also works now. +- `all_edges` is documented and exported, and reports its `eltype` and `length` + correctly. It previously advertised `eltype` of `Any` and threw from `length` + on undirected graphs ([#192](https://github.com/ITensor/NamedGraphs.jl/pull/192)). - `Combinatorics`, `Random`, `Suppressor`, `SimpleGraphConverter`, and `PackageExtensionCompat` are no longer dependencies, so installing NamedGraphs no longer pulls in `Optim` or `LightXML` diff --git a/src/abstractnamedgraph.jl b/src/abstractnamedgraph.jl index a547827..f32f345 100644 --- a/src/abstractnamedgraph.jl +++ b/src/abstractnamedgraph.jl @@ -269,12 +269,18 @@ end edges(graph::AbstractNamedGraph) -> Graphs.AbstractEdgeIter A `Graphs.AbstractEdgeIter` over the edges of `graph`, yielding each edge -exactly once, with membership testing (`in`) matching `has_edge` (in particular, -on undirected graphs an edge and its reverse are both members while iteration -yields each edge once). The iteration order is unspecified. +exactly once. -Only the `Graphs.AbstractEdgeIter` interface is promised. The concrete type is -currently `NamedGraphs.NamedEdgeIter`, which may change. +It can be iterated, so it works in a `for` loop and with `collect`. `length` +gives the number of edges and `eltype` gives the edge type of the graph, +generally `NamedEdge{V}` for a graph with vertex type `V`. Membership testing +with `in` matches `has_edge`, so on an undirected graph an edge and its reverse +are both members even though iteration yields each edge once. + +The iteration order is an implementation detail of how the graph stores its +edges and is not part of the interface. + +The concrete type is currently `NamedGraphs.NamedEdgeIter`, which may change. The output is a live view of the graph: do not rely on it across mutations of the graph. @@ -297,6 +303,9 @@ julia> for e in edges(g) julia> length(edges(g)) 2 +julia> eltype(edges(g)) +NamedEdge{String} + julia> collect(edges(g)) 2-element Vector{NamedEdge{String}}: "a" => "b" From e75ed191dd25b77aa8dbacd806941ad948d939e6 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 10:18:06 -0400 Subject: [PATCH 3/9] Sort the 0.14 breaking changes by how commonly they come up Merge order put the changes that cost nothing next to the ones that cost the most. Also adds the three that fail silently rather than erroring, and folds the entries that moved names around the removed submodule into one describing where they ended up. --- docs/src/changelog.md | 249 +++++++++++++----------------------------- 1 file changed, 73 insertions(+), 176 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index f8d6975..040f0e6 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -5,182 +5,73 @@ Reworks how named vertices and edges are translated to the integer vertices and edges used internally. -### Upgrading - -These are the changes that existing code actually runs into, ordered by how -often they came up when migrating the packages that depend on NamedGraphs. The -"Other breaking changes" section below has the rest. - -#### The submodules are gone - -`GraphsExtensions`, `Keys`, `SimilarType`, `GraphGenerators`, -`NamedGraphGenerators`, `OrdinalIndexing`, and `OrderedDictionaries` no longer -exist. `PartitionedGraphs` is the only remaining submodule. Their contents are -available directly from `NamedGraphs`, so an import like - -```julia -using NamedGraphs.GraphsExtensions: boundary_edges -using NamedGraphs.NamedGraphGenerators: named_grid -``` - -becomes - -```julia -using NamedGraphs: boundary_edges, named_grid -``` - -This is the most common change by volume and the least interesting: it fails -loudly at load with an `UndefVarError` naming the submodule, and the fix is to -delete the submodule from the path. Two cases need more than that: - -- The `Key` type is deleted rather than moved. Contraction sequences over - non-scalar vertices are built on it, so code that used it needs its own +### Breaking changes + +- The `GraphsExtensions`, `Keys`, `SimilarType`, `GraphGenerators`, + `NamedGraphGenerators`, `OrdinalIndexing`, and `OrderedDictionaries` + submodules are removed, leaving `PartitionedGraphs` as the only submodule. + Their contents are available directly from `NamedGraphs`, so + `using NamedGraphs.GraphsExtensions: boundary_edges` becomes + `using NamedGraphs: boundary_edges` + ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183), + [#187](https://github.com/ITensor/NamedGraphs.jl/pull/187), + [#189](https://github.com/ITensor/NamedGraphs.jl/pull/189), + [#190](https://github.com/ITensor/NamedGraphs.jl/pull/190)). +- The `Key` type is deleted rather than moved. Code that used it needs its own equivalent, along with a `NamedGraphs.to_graph_index(graph, key::Key)` method - so the graph knows how to unwrap it. -- `vertices(g)[4th]` from `OrdinalIndexing` becomes `decoded_vertex(g, 4)`. - -([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183), -[#187](https://github.com/ITensor/NamedGraphs.jl/pull/187), -[#189](https://github.com/ITensor/NamedGraphs.jl/pull/189), -[#190](https://github.com/ITensor/NamedGraphs.jl/pull/190)) - -#### `edges(g)` returns a lazy iterator - -`edges(g)` now returns a `Graphs.AbstractEdgeIter` rather than a `Vector`, -matching `edges(::SimpleGraph)` in Graphs.jl. Membership (`in`) matches -`has_edge`, and `==` between two edge iterators compares the edge sets. - -Most of the resulting errors do not mention `edges`, so they are worth listing -by symptom: - -| what you wrote | what you get | -|---|---| -| `filter(f, edges(g))` | `MethodError: no method matching filter(::F, ::NamedGraphs.NamedEdgeIter{...})` | -| `findfirst(f, edges(g))` | `MethodError: no method matching keys(::NamedGraphs.NamedEdgeIter{...})` | -| `edges(g)[i]` | `MethodError: no method matching getindex(::NamedGraphs.NamedEdgeIter{...}, ::Int64)` | -| a `Vector{<:AbstractEdge}` argument defaulting to `edges(g)` | a `MethodError` naming a generated keyword-body function rather than the function you called | - -Adding `collect` at the call site fixes all of these. - -Plenty still works directly, so there is no need to `collect` defensively: -iteration, `length`, `first`, `in`, `==`, `issetequal`, `union`, `setdiff`, -broadcasting (`reverse.(edges(g))` gives a properly typed `Vector`), and -building a `Dictionary` or `Indices` from the result. - -**One case changes behavior instead of erroring.** `vcat` treats anything that -is not an `AbstractArray` as a single scalar element, so - -```julia -julia> vcat(edges(g), reverse.(edges(g))) -5-element Vector{Any}: - NamedEdge{Tuple{Int64, Int64}}[(1, 1) => (2, 1), (1, 1) => (1, 2), (2, 1) => (2, 2), (1, 2) => (2, 2)] - (2, 1) => (1, 1) - (1, 2) => (1, 1) - (2, 2) => (2, 1) - (2, 2) => (1, 2) -``` - -gives five elements on a four-edge graph, the first of which is the whole edge -list, where the intended result has eight. `collect` the first argument. - -**`edges(g)` is also a live view of the graph rather than a snapshot.** Holding -on to it across a mutation now sees the mutation: - -```julia -julia> es = edges(g); length(es) -4 - -julia> rem_edge!(g, first(es)); length(es) -3 -``` - -`collect` it first if you need the edges as they were. - -([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)) - -#### Vertex order and integer codes diverge after a removal - -`vertices(g::Named[Di]Graph)` outputs a `Dictionaries.Indices` instead of the -internal `OrderedIndices` type. Other `AbstractNamedGraph` types can output -other `AbstractIndices` set views. Indexing is by vertex name, not position. - -Vertices iterate in insertion order, which is stable under removals. The -integer codes are not: removing a vertex moves the last code into the freed -slot. In v0.13 those two orders were kept in agreement, and in v0.14 they part -company after the first removal: - -```julia -julia> g = NamedGraph(path_graph(5), ["a", "b", "c", "d", "e"]); rem_vertex!(g, "b"); - -julia> collect(vertices(g)) -4-element Vector{String}: - "a" - "c" - "d" - "e" - -julia> [decoded_vertex(g, code) for code in 1:nv(g)] -4-element Vector{String}: - "a" - "e" - "c" - "d" -``` - -Nothing errors here, so code that computes something on the integer graph and -then maps the result back with `collect(vertices(g))[code]` silently gets the -wrong vertex. Translate through `decoded_vertex(g, code)` instead. - -([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)) - -#### `encoded_graph` and friends replace the position graph - -The "position graph" terminology is replaced with encode and decode -terminology. The overloads for implementing a new `AbstractNamedGraph` are -`encoded_graph(g)` (replaces `position_graph`, with a generic `EncodedGraphView` -fallback so a graph type does not need to store an integer graph), -`encoded_vertex(g, v)` (replaces `vertex_positions`), and `decoded_vertex(g, c)` -(replaces `ordered_vertices`). Codes are not stable across mutation. - -This is not a symbol-level rename. `vertex_positions(g)` and -`ordered_vertices(g)` returned a whole mapping, while `encoded_vertex(g, v)` and -`decoded_vertex(g, c)` translate a single vertex, so a type that forwarded the -old three in a loop over function names has to write the new ones out as -separate methods. - -([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)) - -#### Mutators return `Bool` and counts - -`rem_vertex!`, `add_edge!`, and `rem_edge!` return `true` or `false` following -Graphs.jl, matching `add_vertex!`. Previously they returned the graph, and -`add_edge!`/`rem_edge!` threw for edges with vertices not in the graph, which -now returns `false`. - -The plural mutators `add_edges!`, `rem_edges!`, `add_vertices!`, and -`rem_vertices!` return the number of successful additions or removals, where -they previously returned the graph. `Bool` from the singular `Graphs.add_edge!` -is the one-element case of the same count, and `Graphs.add_vertices!` already -returned a count. `rem_quotientvertex!` and `rem_quotientedge!` likewise return -how many underlying vertices or edges went, so `0` means the quotient vertex or -edge was not there. - -This affects types that define these methods rather than code that calls them. -A type of that kind needs two things beyond the return value: a `has_vertex` -guard so that removing an absent vertex returns `false` instead of throwing, -and `Dictionaries.unset!` in place of `delete!` where a missing key would -otherwise throw. - -([#179](https://github.com/ITensor/NamedGraphs.jl/pull/179), -[#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)) - -### Other breaking changes - -- `GenericNamedGraph{V, G}` is removed (it was not exported, so this only - affects code that imported it explicitly). `NamedGraph{V}` and - `NamedDiGraph{V}` are now separately defined concrete types, hardcoded to - `SimpleGraph{Int}` and `SimpleDiGraph{Int}` underlying storage + ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). +- `vertices(g)[4th]` becomes `decoded_vertex(g, 4)`, since `OrdinalIndexing` is + removed ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- `edges(g)` outputs a lazy iterator instead of a `Vector`, like + `edges(::SimpleGraph)` in Graphs.jl. Membership (`in`) matches `has_edge`, and + `==` between two edge iterators compares the edge sets. Code that indexed, + `filter`ed, or `findfirst`ed the result should `collect` it first. Iteration, + `length`, `first`, `issetequal`, `union`, `setdiff`, broadcasting, and building + a `Dictionary` or `Indices` all work directly + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- `vcat` treats the edge iterator as a single element rather than a collection, + so `vcat(edges(g), reverse.(edges(g)))` returns a nested `Vector{Any}` instead + of the combined edges, without erroring. `collect` the first argument + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- `edges(g)` is a live view of the graph rather than a snapshot, so holding on to + it across a mutation of the graph now sees the mutation + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- `vertices(g::Named[Di]Graph)` outputs a `Dictionaries.Indices` instead of the + internal `OrderedIndices` type, which is removed along with the + `OrderedDictionaries` submodule. Other `AbstractNamedGraph` types can output + other `AbstractIndices` set views. Indexing is by vertex name, not position + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- Vertices iterate in insertion order, which no longer matches the integer codes + after a removal, where v0.13 kept the two in agreement. Nothing errors, so code + that maps a result computed on the integer graph back through + `collect(vertices(g))[code]` silently gets the wrong vertex. Translate with + `decoded_vertex(g, code)` instead + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- The "position graph" terminology is replaced with encode and decode + terminology. The overloads for implementing a new `AbstractNamedGraph` are + `encoded_graph(g)` (replaces `position_graph`, with a generic + `EncodedGraphView` fallback so a graph type does not need to store an integer + graph), `encoded_vertex(g, v)` (replaces `vertex_positions`), and + `decoded_vertex(g, c)` (replaces `ordered_vertices`). Codes are not stable + across mutation. The last two translate a single vertex where the functions + they replace returned a whole mapping, so a type that forwarded all three in a + loop over function names has to write them out separately + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- `rem_vertex!`, `add_edge!`, and `rem_edge!` return `true` or `false` following + Graphs.jl, matching `add_vertex!`. Previously they returned the graph, and + `add_edge!`/`rem_edge!` threw for edges with vertices not in the graph, which + now returns `false`. A type defining these needs a `has_vertex` guard so that + removing an absent vertex returns `false` instead of throwing, and + `Dictionaries.unset!` in place of `delete!` ([#179](https://github.com/ITensor/NamedGraphs.jl/pull/179)). +- The plural mutators `add_edges!`, `rem_edges!`, `add_vertices!`, and + `rem_vertices!` return the number of successful additions or removals, where + they previously returned the graph. `Bool` from the singular + `Graphs.add_edge!` is the one-element case of the same count, and + `Graphs.add_vertices!` already returned a count. `rem_quotientvertex!` and + `rem_quotientedge!` likewise return how many underlying vertices or edges went, + so `0` means the quotient vertex or edge was not there + ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). - `add_vertices!` and `rem_vertices!` are methods of the Graphs.jl functions of those names rather than separate functions of NamedGraphs' own, and are declared on `AbstractNamedGraph`. An integer second argument is a vertex name @@ -189,6 +80,11 @@ otherwise throw. - Considerably more names are exported, where previously only the four graph and edge types were, so `using NamedGraphs` can collide with names another package exports ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). +- `GenericNamedGraph{V, G}` is removed (it was not exported, so this only + affects code that imported it explicitly). `NamedGraph{V}` and + `NamedDiGraph{V}` are now separately defined concrete types, hardcoded to + `SimpleGraph{Int}` and `SimpleDiGraph{Int}` underlying storage + ([#179](https://github.com/ITensor/NamedGraphs.jl/pull/179)). - The wrappers around Graphs.jl functions mirror the upstream positional signatures instead of taking `args...` or untyped arguments, so some argument types that were previously accepted no longer are @@ -221,8 +117,9 @@ otherwise throw. Indexing a `QuotientView` by a collection of vertices or edges was broken the same way and also works now. - `all_edges` is documented and exported, and reports its `eltype` and `length` - correctly. It previously advertised `eltype` of `Any` and threw from `length` - on undirected graphs ([#192](https://github.com/ITensor/NamedGraphs.jl/pull/192)). + correctly. It previously advertised an `eltype` of `Any` and threw from + `length` on undirected graphs + ([#192](https://github.com/ITensor/NamedGraphs.jl/pull/192)). - `Combinatorics`, `Random`, `Suppressor`, `SimpleGraphConverter`, and `PackageExtensionCompat` are no longer dependencies, so installing NamedGraphs no longer pulls in `Optim` or `LightXML` From f362efbcaaf34ae6eb542080f00f5c3e2023c791 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 10:21:14 -0400 Subject: [PATCH 4/9] Separate the submodules whose contents moved from those deleted outright Lumping them together pointed readers at names that no longer exist. --- docs/src/changelog.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 040f0e6..c57ee5e 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -7,21 +7,24 @@ and edges used internally. ### Breaking changes -- The `GraphsExtensions`, `Keys`, `SimilarType`, `GraphGenerators`, - `NamedGraphGenerators`, `OrdinalIndexing`, and `OrderedDictionaries` - submodules are removed, leaving `PartitionedGraphs` as the only submodule. - Their contents are available directly from `NamedGraphs`, so - `using NamedGraphs.GraphsExtensions: boundary_edges` becomes +- The `GraphsExtensions`, `SimilarType`, `GraphGenerators`, and + `NamedGraphGenerators` submodules are removed and their contents moved into + `NamedGraphs`, so `using NamedGraphs.GraphsExtensions: boundary_edges` becomes `using NamedGraphs: boundary_edges` ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183), [#187](https://github.com/ITensor/NamedGraphs.jl/pull/187), [#189](https://github.com/ITensor/NamedGraphs.jl/pull/189), [#190](https://github.com/ITensor/NamedGraphs.jl/pull/190)). -- The `Key` type is deleted rather than moved. Code that used it needs its own +- The `Keys`, `OrdinalIndexing`, and `OrderedDictionaries` submodules are removed + along with their contents, which are not available elsewhere. That leaves + `PartitionedGraphs` as the only submodule + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178), + [#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). +- The `Key` type is deleted with no replacement. Code that used it needs its own equivalent, along with a `NamedGraphs.to_graph_index(graph, key::Key)` method ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). -- `vertices(g)[4th]` becomes `decoded_vertex(g, 4)`, since `OrdinalIndexing` is - removed ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). +- `vertices(g)[4th]` becomes `decoded_vertex(g, 4)` + ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). - `edges(g)` outputs a lazy iterator instead of a `Vector`, like `edges(::SimpleGraph)` in Graphs.jl. Membership (`in`) matches `has_edge`, and `==` between two edge iterators compares the edge sets. Code that indexed, From b109a59a04e201a971bb240da281cec80f1f8ecc Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 10:22:57 -0400 Subject: [PATCH 5/9] Drop the to_graph_index aside from the Key entry --- docs/src/changelog.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index c57ee5e..c50b14c 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -21,8 +21,7 @@ and edges used internally. ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178), [#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). - The `Key` type is deleted with no replacement. Code that used it needs its own - equivalent, along with a `NamedGraphs.to_graph_index(graph, key::Key)` method - ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). + equivalent ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). - `vertices(g)[4th]` becomes `decoded_vertex(g, 4)` ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). - `edges(g)` outputs a lazy iterator instead of a `Vector`, like From abe4a65cc2f98be5ee116facda907a19eb18bdae Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 10:23:38 -0400 Subject: [PATCH 6/9] Point the deleted-submodules entry at the vertices output type --- docs/src/changelog.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index c50b14c..3e96d8a 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -16,8 +16,9 @@ and edges used internally. [#189](https://github.com/ITensor/NamedGraphs.jl/pull/189), [#190](https://github.com/ITensor/NamedGraphs.jl/pull/190)). - The `Keys`, `OrdinalIndexing`, and `OrderedDictionaries` submodules are removed - along with their contents, which are not available elsewhere. That leaves - `PartitionedGraphs` as the only submodule + along with their contents, which are not available elsewhere, leaving + `PartitionedGraphs` as the only submodule. See the entry below on the output + type of `vertices` for what replaces `OrderedIndices` ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178), [#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). - The `Key` type is deleted with no replacement. Code that used it needs its own From 0df2f1251765ab93f5da09acbc9b0a462ce2ca47 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 10:25:26 -0400 Subject: [PATCH 7/9] Fold the vcat behavior into the edges entry --- docs/src/changelog.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 3e96d8a..f1c4664 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -28,13 +28,11 @@ and edges used internally. - `edges(g)` outputs a lazy iterator instead of a `Vector`, like `edges(::SimpleGraph)` in Graphs.jl. Membership (`in`) matches `has_edge`, and `==` between two edge iterators compares the edge sets. Code that indexed, - `filter`ed, or `findfirst`ed the result should `collect` it first. Iteration, - `length`, `first`, `issetequal`, `union`, `setdiff`, broadcasting, and building - a `Dictionary` or `Indices` all work directly - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). -- `vcat` treats the edge iterator as a single element rather than a collection, - so `vcat(edges(g), reverse.(edges(g)))` returns a nested `Vector{Any}` instead - of the combined edges, without erroring. `collect` the first argument + `filter`ed, or `findfirst`ed the result should `collect` it first, and `vcat` + takes the iterator as a single element rather than a collection, so it + silently returns a nested `Vector{Any}` where it previously combined the edges. + Iteration, `length`, `first`, `issetequal`, `union`, `setdiff`, broadcasting, + and building a `Dictionary` or `Indices` all work directly ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). - `edges(g)` is a live view of the graph rather than a snapshot, so holding on to it across a mutation of the graph now sees the mutation From caaebea35dbefe7e3a9e25c7f3ad0ad46e14acf2 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 10:30:07 -0400 Subject: [PATCH 8/9] Reorder the breaking changes and merge the submodule removals into them Each removed submodule is now described where its replacement is, so the `edges` and `vertices` output types and the encode and decode interface come first and the rest follows. --- docs/src/changelog.md | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index f1c4664..6e87d73 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -7,24 +7,14 @@ and edges used internally. ### Breaking changes -- The `GraphsExtensions`, `SimilarType`, `GraphGenerators`, and - `NamedGraphGenerators` submodules are removed and their contents moved into +- The `NamedGraphGenerators`, `GraphsExtensions`, `GraphGenerators`, and + `SimilarType` submodules are removed and their contents moved into `NamedGraphs`, so `using NamedGraphs.GraphsExtensions: boundary_edges` becomes `using NamedGraphs: boundary_edges` ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183), [#187](https://github.com/ITensor/NamedGraphs.jl/pull/187), [#189](https://github.com/ITensor/NamedGraphs.jl/pull/189), [#190](https://github.com/ITensor/NamedGraphs.jl/pull/190)). -- The `Keys`, `OrdinalIndexing`, and `OrderedDictionaries` submodules are removed - along with their contents, which are not available elsewhere, leaving - `PartitionedGraphs` as the only submodule. See the entry below on the output - type of `vertices` for what replaces `OrderedIndices` - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178), - [#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). -- The `Key` type is deleted with no replacement. Code that used it needs its own - equivalent ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). -- `vertices(g)[4th]` becomes `decoded_vertex(g, 4)` - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). - `edges(g)` outputs a lazy iterator instead of a `Vector`, like `edges(::SimpleGraph)` in Graphs.jl. Membership (`in`) matches `has_edge`, and `==` between two edge iterators compares the edge sets. Code that indexed, @@ -32,15 +22,16 @@ and edges used internally. takes the iterator as a single element rather than a collection, so it silently returns a nested `Vector{Any}` where it previously combined the edges. Iteration, `length`, `first`, `issetequal`, `union`, `setdiff`, broadcasting, - and building a `Dictionary` or `Indices` all work directly - ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). -- `edges(g)` is a live view of the graph rather than a snapshot, so holding on to - it across a mutation of the graph now sees the mutation + and building a `Dictionary` or `Indices` all work directly. The output is a + live view of the graph rather than a snapshot, so holding on to it across a + mutation of the graph now sees the mutation ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). - `vertices(g::Named[Di]Graph)` outputs a `Dictionaries.Indices` instead of the - internal `OrderedIndices` type, which is removed along with the - `OrderedDictionaries` submodule. Other `AbstractNamedGraph` types can output - other `AbstractIndices` set views. Indexing is by vertex name, not position + internal `OrderedIndices` type, and the `OrderedDictionaries` and + `OrdinalIndexing` submodules are removed along with their contents. Other + `AbstractNamedGraph` types can output other `AbstractIndices` set views. + Indexing is by vertex name, not position, and `vertices(g)[4th]` becomes + `decoded_vertex(g, 4)` ([#178](https://github.com/ITensor/NamedGraphs.jl/pull/178)). - Vertices iterate in insertion order, which no longer matches the integer codes after a removal, where v0.13 kept the two in agreement. Nothing errors, so code @@ -81,6 +72,9 @@ and edges used internally. - Considerably more names are exported, where previously only the four graph and edge types were, so `using NamedGraphs` can collide with names another package exports ([#188](https://github.com/ITensor/NamedGraphs.jl/pull/188)). +- The `Keys` submodule and its `Key` type are removed with no replacement. Code + that used `Key` needs its own equivalent + ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). - `GenericNamedGraph{V, G}` is removed (it was not exported, so this only affects code that imported it explicitly). `NamedGraph{V}` and `NamedDiGraph{V}` are now separately defined concrete types, hardcoded to From 47db7d6acb259b314c44a115970dd7f3a86894c1 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Mon, 31 Aug 2026 10:34:22 -0400 Subject: [PATCH 9/9] Correct the all_edges entry and merge the wrapper signature entries The `eltype` and `length` problems it described were introduced during 0.14 rather than inherited from 0.13, so what changed since 0.13 is the narrowing to `AbstractNamedGraph` and the lazy output. The `eccentricity` and `induced_subgraph` entries are instances of the wrapper signature change, so they move into it. --- docs/src/changelog.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 6e87d73..c028312 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -10,7 +10,9 @@ and edges used internally. - The `NamedGraphGenerators`, `GraphsExtensions`, `GraphGenerators`, and `SimilarType` submodules are removed and their contents moved into `NamedGraphs`, so `using NamedGraphs.GraphsExtensions: boundary_edges` becomes - `using NamedGraphs: boundary_edges` + `using NamedGraphs: boundary_edges`, + `using NamedGraphs.NamedGraphGenerators: named_grid` becomes + `using NamedGraphs: named_grid`, and so on ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183), [#187](https://github.com/ITensor/NamedGraphs.jl/pull/187), [#189](https://github.com/ITensor/NamedGraphs.jl/pull/189), @@ -75,6 +77,10 @@ and edges used internally. - The `Keys` submodule and its `Key` type are removed with no replacement. Code that used `Key` needs its own equivalent ([#183](https://github.com/ITensor/NamedGraphs.jl/pull/183)). +- `all_edges` takes an `AbstractNamedGraph`, where it previously took any + `Graphs.AbstractGraph`, and outputs a lazy iterator, so on a directed graph it + no longer returns an allocated `Vector` + ([#192](https://github.com/ITensor/NamedGraphs.jl/pull/192)). - `GenericNamedGraph{V, G}` is removed (it was not exported, so this only affects code that imported it explicitly). `NamedGraph{V}` and `NamedDiGraph{V}` are now separately defined concrete types, hardcoded to @@ -82,14 +88,12 @@ and edges used internally. ([#179](https://github.com/ITensor/NamedGraphs.jl/pull/179)). - The wrappers around Graphs.jl functions mirror the upstream positional signatures instead of taking `args...` or untyped arguments, so some argument - types that were previously accepted no longer are - ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). -- `eccentricity(graph, x)` is always the eccentricity of the single vertex `x`. - The every-vertex form is `eccentricities` - ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). -- A `Vector{Bool}` passed to `induced_subgraph` is a list of vertex names, not a - mask over `1:nv(graph)`, and `induced_subgraph` throws for vertices the graph - does not have, where it previously returned a graph built on them + types that were previously accepted no longer are. In particular, + `eccentricity(graph, x)` is always the eccentricity of the single vertex `x`, + with `eccentricities` as the every-vertex form, and a `Vector{Bool}` passed to + `induced_subgraph` is a list of vertex names rather than a mask over + `1:nv(graph)`. `induced_subgraph` also throws for vertices the graph does not + have, where it previously returned a graph built on them ([#186](https://github.com/ITensor/NamedGraphs.jl/pull/186)). - `rename_vertices(edge, name_map)` is removed. Write `rename_vertices(v -> name_map[v], edge)` @@ -111,9 +115,7 @@ and edges used internally. [#187](https://github.com/ITensor/NamedGraphs.jl/pull/187)). Indexing a `QuotientView` by a collection of vertices or edges was broken the same way and also works now. -- `all_edges` is documented and exported, and reports its `eltype` and `length` - correctly. It previously advertised an `eltype` of `Any` and threw from - `length` on undirected graphs +- `all_edges` is documented and exported ([#192](https://github.com/ITensor/NamedGraphs.jl/pull/192)). - `Combinatorics`, `Random`, `Suppressor`, `SimpleGraphConverter`, and `PackageExtensionCompat` are no longer dependencies, so installing