Skip to content

Commit 886f3ca

Browse files
committed
Remove BEAST
1 parent c827d58 commit 886f3ca

15 files changed

+124
-184
lines changed

Project.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,30 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
88
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
99

1010
[weakdeps]
11-
BEAST = "bb4162c7-ba94-5a20-af32-d8ec4428bdd1"
1211
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1312

1413
[extensions]
15-
GraphColoringBEAST = ["BEAST"]
1614
GraphColoringGraphs = ["Graphs"]
1715

1816
[compat]
19-
julia = "1.10"
20-
LinearAlgebra = "1"
21-
BEAST = "2"
17+
Aqua = "0.8"
2218
CompScienceMeshes = "0.9"
2319
DataStructures = ">=0.18.1"
2420
Graphs = "1"
25-
Aqua = "0.8"
21+
JLD2 = ">=0.4"
22+
JuliaFormatter = "2.1"
23+
LinearAlgebra = "1"
2624
SparseArrays = "1"
2725
Test = "1"
28-
JuliaFormatter = "2.1"
2926
TestItemRunner = "1.1"
3027
TestItems = "1.0"
28+
julia = "1.10"
3129

3230
[extras]
3331
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
34-
BEAST = "bb4162c7-ba94-5a20-af32-d8ec4428bdd1"
3532
CompScienceMeshes = "3e66a162-7b8c-5da0-b8f8-124ecd2c3ae1"
3633
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
34+
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
3735
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
3836
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3937
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
@@ -42,4 +40,4 @@ TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
4240
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
4341

4442
[targets]
45-
test = ["Aqua", "BEAST", "CompScienceMeshes", "Graphs", "JuliaFormatter", "LinearAlgebra", "SparseArrays", "Test", "TestItemRunner", "TestItems"]
43+
test = ["Aqua", "CompScienceMeshes", "Graphs", "JLD2", "JuliaFormatter", "LinearAlgebra", "SparseArrays", "Test", "TestItemRunner", "TestItems"]

docs/make.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using GraphColoring
2-
using Graphs, BEAST, PlotlyJS
2+
using Graphs, PlotlyJS
33
using Documenter
44

55
import GraphColoring:
@@ -19,11 +19,6 @@ DocMeta.setdocmeta!(GraphColoring, :DocTestSetup, :(using GraphColoring); recurs
1919
makedocs(;
2020
modules=[
2121
GraphColoring,
22-
if isdefined(Base, :get_extension)
23-
Base.get_extension(GraphColoring, :GraphColoringBEAST)
24-
else
25-
GraphColoring.GraphColoringBEAST
26-
end,
2722
if isdefined(Base, :get_extension)
2823
Base.get_extension(GraphColoring, :GraphColoringGraphs)
2924
else

docs/src/apiref.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
```@autodocs
77
Modules=[GraphColoring,
8-
if isdefined(Base, :get_extension)
9-
Base.get_extension(GraphColoring, :GraphColoringBEAST)
10-
else
11-
GraphColoring.GraphColoringBEAST
12-
end,
138
if isdefined(Base, :get_extension)
149
Base.get_extension(GraphColoring, :GraphColoringGraphs)
1510
else

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Currently, the following aspects are implemented (✓) and planned (⌛):
1717

1818
The [GraphColoring](https://github.com/djukic14/GraphColoring.jl) package is related to the following packages:
1919

20-
- [BEAST](https://github.com/krcools/BEAST.jl)
20+
- [`BEAST`](https://github.com/krcools/BEAST.jl)
2121
- [`Graphs.jl`](https://github.com/JuliaGraphs/Graphs.jl)
2222

2323
## Documentation

ext/GraphColoringBEAST.jl

Lines changed: 0 additions & 57 deletions
This file was deleted.

ext/GraphColoringGraphs.jl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,20 @@ A SimpleGraph representing the conflict graph.
2424
This function works by first computing the conflict matrix using the `conflictmatrix` function, and then creating a SimpleGraph from the matrix.
2525
"""
2626
function conflictgraph(X; kwargs...)
27-
return SimpleGraph(conflictmatrix(X; kwargs...))
27+
elements, conflicts, conflictids = GraphColoring.conflicts(X; kwargs...)
28+
reverseconflicts = GraphColoring.reverseconflicts(elements, conflicts, conflictids)
29+
30+
graph = SimpleGraph(length(elements))
31+
32+
for elements in reverseconflicts
33+
for element in elements
34+
for element2 in elements
35+
element == element2 && continue
36+
add_edge!(graph, element, element2)
37+
end
38+
end
39+
end
40+
return graph
2841
end
2942

3043
"""
@@ -80,4 +93,4 @@ function noconflicts(g::AbstractGraph)
8093
return iszero(ne(g))
8194
end
8295

83-
end # module GraphColoringBEAST
96+
end # module GraphColoringGraphs

src/GraphColoring.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ function color(conflicts; algorithm=Workstream(DSATUR()))
3939
end
4040

4141
export color, WorkstreamDSATUR, WorkstreamGreedy, Workstream, DSATUR, Greedy
42+
export PassThroughConflictFunctor
4243

4344
if !isdefined(Base, :get_extension)
4445
include("../ext/GraphColoringGraphs.jl")
45-
include("../ext/GraphColoringBEAST.jl")
4646
end
4747

4848
end # module GraphColoring

src/conflicts.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,29 @@ representation.
157157
function noconflicts(s::SparseMatrixCSC)
158158
return iszero(nnz(s))
159159
end
160+
161+
"""
162+
struct PassThroughConflictFunctor{E,C1,C2}
163+
164+
A functor that passes through elements, conflicts, and conflict IDs for the `conflicts` function.
165+
166+
# Fields
167+
168+
- `elements::E`: The elements to be passed through.
169+
- `conflicts::C1`: The conflicts to be passed through.
170+
- `conflictids::C2`: The conflict IDs to be passed through.
171+
"""
172+
struct PassThroughConflictFunctor{E,C1,C2}
173+
elements::E
174+
conflicts::C1
175+
conflictids::C2
176+
end
177+
178+
"""
179+
conflicts(f::PassThroughConflictFunctor; kwargs...)
180+
181+
Returns the elements, conflicts, and conflict IDs of the functor.
182+
"""
183+
function conflicts(f::PassThroughConflictFunctor; kwargs...)
184+
return f.elements, f.conflicts, f.conflictids
185+
end

test/assets/conflictexamples.jld2

25.2 MB
Binary file not shown.

test/test_colorzones.jl

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
using CompScienceMeshes
2-
using BEAST
3-
using Test
2+
using Test, JLD2
43
using GraphColoring
54
using SparseArrays
65
using Graphs
76

7+
conflictexamples = load(
8+
joinpath(pkgdir(GraphColoring), "test", "assets", "conflictexamples.jld2")
9+
)["conflictsdict"]
810
@testset "Color zones" begin
9-
ms = [
10-
meshrectangle(1.0, 1.0, 0.1),
11-
meshcuboid(1.0, 1.0, 1.0, 0.1),
12-
CompScienceMeshes.readmesh(
13-
joinpath(pkgdir(GraphColoring), "test", "assets", "in", "sphere.in")
14-
),
15-
CompScienceMeshes.readmesh(
16-
joinpath(pkgdir(GraphColoring), "test", "assets", "in", "multiplerects.in")
17-
),
18-
CompScienceMeshes.readmesh(
19-
joinpath(pkgdir(GraphColoring), "test", "assets", "in", "twospheres.in")
20-
),
21-
]
11+
ms = ["rectangle", "cuboid", "sphere", "multiplerects", "twospheres"]
12+
Xs = ["rt", "lagrangecxd0", "lagrangec0d1", "bc"]
2213

2314
for m in ms
24-
for X in [raviartthomas(m), lagrangecxd0(m), lagrangec0d1(m), buffachristiansen(m)]
25-
for s in [GraphColoring.conflictmatrix(X), GraphColoring.conflictgraph(X)]
15+
for X in Xs
16+
elements, conflictindices, conflictids = conflictexamples[(m, X)]
17+
conflicts = GraphColoring.ConflictFunctor(conflictindices)
18+
c = GraphColoring.PassThroughConflictFunctor(elements, conflicts, conflictids)
19+
for s in [GraphColoring.conflictmatrix(c), GraphColoring.conflictgraph(c)]
2620
oddzones, evenzones = GraphColoring.partition(s)
2721

2822
for algorithm in [GraphColoring.DSATUR(), GraphColoring.Greedy()]

0 commit comments

Comments
 (0)