Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e45385a
Rename `PartitionsGraphView` -> `QuotientGraph` and `partitions_graph…
Nov 3, 2025
609c855
Rename `PartitionVertex` -> `SuperVertex` and `PartitionEdge` -> `Sup…
Nov 3, 2025
c8805cd
Remove some duplicate methods overwriting each other
Nov 3, 2025
345ef6b
Version bump
Nov 3, 2025
c412e31
Remove `quotient_graph` function in favour of a direct call to `Quoti…
Nov 4, 2025
2791da4
Runic formatting
Nov 4, 2025
431ce5d
Overhaul PartitionedGraphs Library
Nov 5, 2025
a9d77a5
Remove `AbstractSuperVertex`
Nov 5, 2025
68ecf0d
Remove `AbstractSuperEdge`
Nov 5, 2025
242a24b
Simplify and remove methods related to adding/removing indices
Nov 5, 2025
004de0b
Move some functionality to `AbstractGraph`
Nov 6, 2025
f42ba96
Further improvements to interface.
Nov 6, 2025
fa5ceba
Rework interface in favour of overloading `quotient_graph`
Nov 10, 2025
43c89da
Add `PartitionedView` type for constructing partitions of an `Abstrac…
Nov 11, 2025
ef7dffa
Remove unnecessary type parameter in `PartitionedGraph`
Nov 11, 2025
d1844d4
Rename `partitions` -> `partition_vertices`
Nov 11, 2025
f1a01d9
Rename `find_quotient_vertex` and `find_quotient_edge` to `quotient_v…
Nov 11, 2025
4436bc2
Remove commented out line of code
Nov 11, 2025
2290dbf
Fix type of in code comment and drop explicit `NamedEdge` construction.
Nov 11, 2025
a4fc5e9
Fix definition of `is_boundary_edge` to align with function name; rem…
Nov 11, 2025
66040f6
Add `SubSuperVertex` type for adding vertices to partition graphs
Nov 11, 2025
2951717
Fix issues with functions `ne` and `nv` when used with `SuperVertex` …
Nov 11, 2025
c541c20
Parmaterise directly on the type of the partition mapping.
Nov 11, 2025
d27294e
Remove 3-arg `add_vertex!` method in favour of `add_subsupervertex!` …
Nov 11, 2025
52c97a7
Fix docstring indent.
jack-dunham Nov 11, 2025
0a4da53
Rename `is_boundary_edge` to `is_partition_boundary_edge`.
Nov 11, 2025
623beae
Define `induced_subgraph` method on super-vertices generically.
Nov 11, 2025
abfda68
Code comment styling.
Nov 11, 2025
d330d3f
Runic formatting
Nov 11, 2025
415c612
Fallback `quotient_graph_type` now corresponds to the case where prov…
Nov 11, 2025
d4b464d
`PartitionedGraph` now properly uses the `vertextype` of the underlyi…
Nov 11, 2025
21d51dd
Add generic interface functions for partitioning/unpartitioning graphs
Nov 11, 2025
170e51b
The type `QuotientView{V} where {V}` is now constructed such that `V`…
Nov 11, 2025
bf038fd
Add more unit tests for partitioned graphs interface
Nov 11, 2025
b4ab434
`unpartition` now works on any `AbstractGraph` assume an implementati…
Nov 12, 2025
7364a7c
`PartitionedGraph` now has vertex type parameter matching the vertex …
jack-dunham Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NamedGraphs"
uuid = "678767b0-92e7-4007-89e4-4527a8725b19"
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>, Joseph Tindall <jtindall@flatironinstitute.org> and contributors"]
version = "0.7.4"
version = "0.8.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"
[compat]
Documenter = "1.10"
Literate = "2.20.1"
NamedGraphs = "0.7"
NamedGraphs = "0.8"
2 changes: 1 addition & 1 deletion examples/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"

[compat]
Graphs = "1.12.0"
NamedGraphs = "0.7.0"
NamedGraphs = "0.8.0"
4 changes: 2 additions & 2 deletions ext/NamedGraphsKaHyParExt/NamedGraphsKaHyParExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ const KAHYPAR_ALGS = Dict(
)

"""
partitioned_vertices(::Backend"kahypar", g::Graph, npartiations::Integer; objective="edge_cut", alg="kway", kwargs...)
partition_vertices(::Backend"kahypar", g::Graph, npartiations::Integer; objective="edge_cut", alg="kway", kwargs...)

- default_configuration => "cut_kKaHyPar_sea20.ini"
- :edge_cut => "cut_kKaHyPar_sea20.ini"
- :connectivity => "km1_kKaHyPar_sea20.ini"
- imbalance::Number=0.03
"""
function GraphsExtensions.partitioned_vertices(
function GraphsExtensions.partition_vertices(
::Backend"kahypar",
g::AbstractSimpleGraph,
npartitions::Integer;
Expand Down
4 changes: 2 additions & 2 deletions ext/NamedGraphsMetisExt/NamedGraphsMetisExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ GraphsExtensions.set_partitioning_backend!(Backend"metis"())
const METIS_ALGS = Dict(["kway" => :KWAY, "recursive" => :RECURSIVE])

"""
partitioned_vertices(::Backend"metis", g::AbstractGraph, npartitions::Integer; alg="recursive")
partition_vertices(::Backend"metis", g::AbstractGraph, npartitions::Integer; alg="recursive")

Partition the graph `G` in `n` parts.
The partition algorithm is defined by the `alg` keyword:
- :KWAY: multilevel k-way partitioning
- :RECURSIVE: multilevel recursive bisection
"""
function GraphsExtensions.partitioned_vertices(
function GraphsExtensions.partition_vertices(
::Backend"metis", g::AbstractSimpleGraph, npartitions::Integer; alg = "recursive", kwargs...
)
metis_alg = METIS_ALGS[alg]
Expand Down
20 changes: 9 additions & 11 deletions src/abstractnamedgraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using .GraphsExtensions:
GraphsExtensions,
directed_graph,
incident_edges,
partitioned_vertices,
partition_vertices,
rename_vertices,
subgraph
using SimpleTraits: SimpleTraits, Not, @traitfn
Expand Down Expand Up @@ -66,7 +66,8 @@ vertex_positions(graph::AbstractNamedGraph) = not_implemented()
# returns the corresponding vertex.
ordered_vertices(graph::AbstractNamedGraph) = not_implemented()

Graphs.edgetype(graph::AbstractNamedGraph) = not_implemented()
Graphs.edgetype(graph::AbstractNamedGraph) = edgetype(typeof(graph))
Graphs.edgetype(::Type{<:AbstractNamedGraph}) = not_implemented()

# TODO: Define generic version in `GraphsExtensions`.
GraphsExtensions.directed_graph_type(G::Type{<:AbstractNamedGraph}) = not_implemented()
Expand Down Expand Up @@ -285,10 +286,10 @@ function Graphs.mincut(graph::AbstractNamedGraph, distmx::AbstractMatrix{<:Real}
end

# TODO: Make this more generic?
function GraphsExtensions.partitioned_vertices(
function GraphsExtensions.partition_vertices(
graph::AbstractNamedGraph; npartitions = nothing, nvertices_per_partition = nothing, kwargs...
)
vertex_partitions = partitioned_vertices(
vertex_partitions = partition_vertices(
position_graph(graph); npartitions, nvertices_per_partition, kwargs...
)
# TODO: output the reverse of this dictionary (a Vector of Vector
Expand Down Expand Up @@ -446,13 +447,10 @@ function Graphs.blockdiag(graph1::AbstractNamedGraph, graph2::AbstractNamedGraph
return GenericNamedGraph(new_position_graph, new_vertices)
end

# TODO: What `args` are needed?
Graphs.nv(graph::AbstractNamedGraph, args...) = nv(position_graph(graph), args...)
# TODO: What `args` are needed?
Graphs.ne(graph::AbstractNamedGraph, args...) = ne(position_graph(graph), args...)
# TODO: What `args` are needed?
function Graphs.adjacency_matrix(graph::AbstractNamedGraph, args...)
return adjacency_matrix(position_graph(graph), args...)
Graphs.nv(graph::AbstractNamedGraph) = nv(position_graph(graph))
Graphs.ne(graph::AbstractNamedGraph) = ne(position_graph(graph))
function Graphs.adjacency_matrix(graph::AbstractNamedGraph)
return adjacency_matrix(position_graph(graph))
end

function Graphs.connected_components(graph::AbstractNamedGraph)
Expand Down
8 changes: 2 additions & 6 deletions src/lib/GraphsExtensions/src/partitioning.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function _npartitions(
return error("Must specify either `npartitions` or `nvertices_per_partition`")
end

function partitioned_vertices(
function partition_vertices(
g::AbstractSimpleGraph;
npartitions = nothing,
nvertices_per_partition = nothing,
Expand All @@ -66,11 +66,7 @@ function partitioned_vertices(
if (_npartitions(g, npartitions, nvertices_per_partition) == 1)
return group(v -> 1, collect(vertices(g)))
end
return partitioned_vertices(
return partition_vertices(
Backend(backend), g, _npartitions(g, npartitions, nvertices_per_partition); kwargs...
)
end

function partitioned_vertices(g::AbstractGraph; kwargs...)
return not_implemented()
end
10 changes: 5 additions & 5 deletions src/lib/PartitionedGraphs/src/PartitionedGraphs.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module PartitionedGraphs
include("abstractpartitionvertex.jl")
include("abstractpartitionedge.jl")
include("supervertex.jl")
include("subsupervertex.jl")
include("superedge.jl")
include("abstractpartitionedgraph.jl")
include("partitionvertex.jl")
include("partitionedge.jl")
include("partitionedview.jl")
include("partitionedgraph.jl")
include("partitionsgraphview.jl")
include("quotientgraph.jl")
end
11 changes: 0 additions & 11 deletions src/lib/PartitionedGraphs/src/abstractpartitionedge.jl

This file was deleted.

Loading
Loading