Add Pair type and Boruvka's MST algorithm#241
Open
polka777 wants to merge 14 commits intoSparseLinearAlgebra:mainfrom
Open
Add Pair type and Boruvka's MST algorithm#241polka777 wants to merge 14 commits intoSparseLinearAlgebra:mainfrom
polka777 wants to merge 14 commits intoSparseLinearAlgebra:mainfrom
Conversation
…n with spla primitives
fix clang tidy code style2 fix algorithm.cpp cland tidy 3
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
name: Add Pair type and Boruvka's MST algorithm
about: Implement Pair type with semiring operations and Boruvka algorithm for MST construction
title: "[pull-request] feat: add Pair type and Boruvka MST algorithm"
labels: enhancement, new-feature
assignees: EgorOrachyov, gsvgit
Short description
This PR adds a new
Pairtype (weight: float, vertex: int) to SPLA, along with necessary semiring operations (MIN_PAIR,MUL_PAIR,ALWAYS_PAIR). Based on this type, Boruvka's algorithm for Minimum Spanning Tree (MST) construction is implemented using thecombMinsemiring pattern. The algorithm iteratively selects minimal outgoing edges for each component and merges them until a single component remains.List of changes
New type
Pairstruct withweight(float) andvertex(int) fieldsmake_pair,min_pair,identity_pair,pair_alwaysfunctionsPAIRtype ID)Core primitives support
Matrix,Vector,Scalarnow supportPairtypeset_pair/get_pairconvenience methodsOperations for Pair
MIN_PAIR— compares pairs (by weight first, then by vertex)MUL_PAIR— combination for semiring: takes weight from first, vertex from secondALWAYS_PAIR— selector that always returns 1IDENTITY_PAIR— unary identity operationBoruvka's MST algorithm
src/algorithm.cppandinclude/spla/algorithm.hppcombMinsemiring for edge selectionOpenCL backend
common_def.clwith conditional macros for Paircommon_api.clwith Pair helper functionscl_mxv.hppto support Pair type with macro-based operationsTesting
test_pair.cpp— unit tests for Pair type and operationsExample
examples/mst.cpp— demo with timings and edge weight readingType of changes
Which character do your changes have to the project? Select using
xthe type of changes to the code base in therequest. You can select multiple options.
Changes aspect
Brief change description. Select using
xthe type of changes to the code base in the request. You can select multipleoptions.
.githubscripts addedTesting strategy
Pair type tests
test_pair.cppvalidates struct creation, basic operations, type registrationHow to validate