-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for edge weights using SimpleWeightedGraphs (#51)
This patch adds support for edge weights based on the SimpleWeightedGraphs package. This is implemented as a package extension, and thus requires Julia 1.9 or newer. Closes #37. Co-authored-by: Rodolfo Carvajal <rodolfo.carvajal@gmail.com> Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>
- Loading branch information
1 parent
905ab8b
commit c365fdc
Showing
5 changed files
with
59 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
module MetisSimpleWeightedGraphs | ||
|
||
using Graphs: ne, nv, outneighbors | ||
using Metis: Metis | ||
using SimpleWeightedGraphs: AbstractSimpleWeightedGraph, get_weight | ||
|
||
""" | ||
graph(G::SimpleWeightedGraphs.AbstractSimpleGraph; weights=true) :: Metis.Graph | ||
Construct the 1-based CSR representation of the weighted graph `G`. | ||
""" | ||
function Metis.graph(G::AbstractSimpleWeightedGraph; weights::Bool=true, kwargs...) | ||
return graph(G; weights=weights, kwargs...) | ||
end | ||
|
||
include("GraphsCommon.jl") | ||
|
||
end # module MetisSimpleWeightedGraphs |
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