-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
1,291 additions
and
1,025 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,52 @@ | ||
name = "NamedGraphs" | ||
uuid = "678767b0-92e7-4007-89e4-4527a8725b19" | ||
authors = ["Matthew Fishman <[email protected]> and contributors"] | ||
version = "0.3.0" | ||
version = "0.4.0" | ||
|
||
[deps] | ||
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" | ||
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4" | ||
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" | ||
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
Requires = "ae029012-a4dd-5104-9daa-d747884805df" | ||
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930" | ||
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66" | ||
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" | ||
|
||
[weakdeps] | ||
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889" | ||
KaHyPar = "2a6221f6-aa48-11e9-3542-2d9e0ef01880" | ||
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b" | ||
SymRCM = "286e6d88-80af-4590-acc9-0001b223b9bd" | ||
|
||
[extensions] | ||
NamedGraphsGraphsFlowsExt = "GraphsFlows" | ||
NamedGraphsKaHyParExt = "KaHyPar" | ||
NamedGraphsMetisExt = "Metis" | ||
NamedGraphsSymRCMExt = "SymRCM" | ||
|
||
[compat] | ||
AbstractTrees = "0.3, 0.4" | ||
Dictionaries = "0.4" | ||
Graphs = "1.8" | ||
GraphsFlows = "0.1.1" | ||
KaHyPar = "0.3.1" | ||
LinearAlgebra = "1.7" | ||
Metis = "1.4" | ||
PackageExtensionCompat = "1" | ||
SimpleTraits = "0.9" | ||
SparseArrays = "1.7" | ||
SplitApplyCombine = "1.2.2" | ||
SymRCM = "0.2.1" | ||
Suppressor = "0.2" | ||
Requires = "1.3" | ||
SymRCM = "0.2.1" | ||
julia = "1.7" | ||
|
||
[extras] | ||
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889" | ||
KaHyPar = "2a6221f6-aa48-11e9-3542-2d9e0ef01880" | ||
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b" | ||
SymRCM = "286e6d88-80af-4590-acc9-0001b223b9bd" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
ext/NamedGraphsGraphsFlowsExt/NamedGraphsGraphsFlowsExt.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module NamedGraphsGraphsFlowsExt | ||
using Graphs: AbstractGraph, IsDirected | ||
using GraphsFlows: GraphsFlows | ||
using NamedGraphs: | ||
NamedGraphs, | ||
AbstractNamedGraph, | ||
DefaultNamedCapacity, | ||
_symmetrize, | ||
dist_matrix_to_parent_dist_matrix, | ||
parent_graph, | ||
parent_vertices_to_vertices, | ||
vertex_to_parent_vertex | ||
using NamedGraphs.GraphsExtensions: GraphsExtensions, directed_graph | ||
using SimpleTraits: SimpleTraits, @traitfn | ||
|
||
@traitfn function NamedGraphs.dist_matrix_to_parent_dist_matrix( | ||
graph::AbstractNamedGraph::IsDirected, dist_matrix::DefaultNamedCapacity | ||
) | ||
return GraphsFlows.DefaultCapacity(graph) | ||
end | ||
|
||
@traitfn function GraphsFlows.mincut( | ||
graph::AbstractNamedGraph::IsDirected, | ||
source, | ||
target, | ||
capacity_matrix=DefaultNamedCapacity(graph), | ||
algorithm::GraphsFlows.AbstractFlowAlgorithm=GraphsFlows.PushRelabelAlgorithm(), | ||
) | ||
parent_part1, parent_part2, flow = GraphsFlows.mincut( | ||
directed_graph(parent_graph(graph)), | ||
vertex_to_parent_vertex(graph, source), | ||
vertex_to_parent_vertex(graph, target), | ||
dist_matrix_to_parent_dist_matrix(graph, capacity_matrix), | ||
algorithm, | ||
) | ||
part1 = parent_vertices_to_vertices(graph, parent_part1) | ||
part2 = parent_vertices_to_vertices(graph, parent_part2) | ||
return (part1, part2, flow) | ||
end | ||
|
||
@traitfn function GraphsFlows.mincut( | ||
graph::AbstractNamedGraph::(!IsDirected), | ||
source, | ||
target, | ||
capacity_matrix=DefaultNamedCapacity(graph), | ||
algorithm::GraphsFlows.AbstractFlowAlgorithm=GraphsFlows.PushRelabelAlgorithm(), | ||
) | ||
return GraphsFlows.mincut( | ||
directed_graph(graph), source, target, _symmetrize(capacity_matrix), algorithm | ||
) | ||
end | ||
|
||
function GraphsExtensions.mincut_partitions( | ||
graph::AbstractGraph, | ||
source, | ||
target, | ||
capacity_matrix=DefaultNamedCapacity(graph), | ||
algorithm::GraphsFlows.AbstractFlowAlgorithm=GraphsFlows.PushRelabelAlgorithm(), | ||
) | ||
part1, part2, flow = GraphsFlows.mincut(graph, source, target, capacity_matrix, algorithm) | ||
return part1, part2 | ||
end | ||
end |
Oops, something went wrong.
254e4cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
254e4cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/105035
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: