-
Notifications
You must be signed in to change notification settings - Fork 1
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
4 changed files
with
45 additions
and
27 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
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,37 +1,43 @@ | ||
""" | ||
mis_size(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure=D3Measure()), reducer::AbstractReducer = MISReducer()) | ||
mis_size(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure=D3Measure()), reducer::AbstractReducer = MISReducer(), show_progress::Bool = false) | ||
Calculate the size of the Maximum Independent Set (MIS) for a given graph. | ||
### Arguments | ||
- `g::AbstractGraph`: The graph for which the MIS size is to be calculated. | ||
### Keyword Arguments | ||
- `branching_strategy::BranchingStrategy`: (optional) The branching strategy to be used. Defaults to a strategy using `table_solver=TensorNetworkSolver`, `selector=MinBoundaryHighDegreeSelector(2, 6, 0)`, and `measure=D3Measure`. | ||
- `reducer::AbstractReducer`: (optional) The reducer to be applied. Defaults to `MISReducer`. | ||
- `show_progress::Bool`: (optional) Whether to show the progress of the branching and reduction process. Defaults to `false`. | ||
### Returns | ||
- An integer representing the size of the Maximum Independent Set for the given graph. | ||
""" | ||
function mis_size(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure = D3Measure()), reducer = MISReducer()) | ||
function mis_size(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure = D3Measure()), reducer = MISReducer(), show_progress::Bool = false) | ||
p = MISProblem(g) | ||
res = branch_and_reduce(p, branching_strategy, reducer, MaxSize) | ||
res = branch_and_reduce(p, branching_strategy, reducer, MaxSize; show_progress) | ||
return res.size | ||
end | ||
|
||
""" | ||
mis_branch_count(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure=D3Measure()), reducer=MISReducer()) | ||
mis_branch_count(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure=D3Measure()), reducer=MISReducer(), show_progress::Bool = false) | ||
Calculate the size and the number of branches of the Maximum Independent Set (MIS) for a given graph. | ||
### Arguments | ||
- `g::AbstractGraph`: The graph for which the MIS size and the number of branches are to be calculated. | ||
### Keyword Arguments | ||
- `branching_strategy::BranchingStrategy`: (optional) The branching strategy to be used. Defaults to a strategy using `table_solver=TensorNetworkSolver`, `selector=MinBoundaryHighDegreeSelector(2, 6, 0)`, and `measure=D3Measure`. | ||
- `reducer::AbstractReducer`: (optional) The reducer to be applied. Defaults to `MISReducer`. | ||
- `show_progress::Bool`: (optional) Whether to show the progress of the branching and reduction process. Defaults to `false`. | ||
### Returns | ||
- A tuple `(size, count)` where `size` is the size of the Maximum Independent Set and `count` is the number of branches. | ||
""" | ||
function mis_branch_count(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure = D3Measure()), reducer = MISReducer()) | ||
function mis_branch_count(g::AbstractGraph; branching_strategy::BranchingStrategy = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = MinBoundaryHighDegreeSelector(2, 6, 0), measure = D3Measure()), reducer = MISReducer(), show_progress::Bool = false) | ||
p = MISProblem(g) | ||
res = branch_and_reduce(p, branching_strategy, reducer, MaxSizeBranchCount) | ||
res = branch_and_reduce(p, branching_strategy, reducer, MaxSizeBranchCount; show_progress) | ||
return (res.size, res.count) | ||
end |