Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

parallelizing kruskal algo

ktrfrk
Beginner
216 Views
hii all. iam a student. i implemented the parallel version of kruskal using tbb as a project. iam attaching the code files. now the problem i hav is wen the number of nodes is greater than 300 the the edges and weights of the edges are changing to 1. i.e., after calling parallel_sort function in kruskalApply function. i donno the reason :( it works fine for small number of nodes. iam intrested in any suggestions as well. thankyou
0 Kudos
3 Replies
ninhngt
Beginner
216 Views
Quoting - ktrfrk
hii all. iam a student. i implemented the parallel version of kruskal using tbb as a project. iam attaching the code files. now the problem i hav is wen the number of nodes is greater than 300 the the edges and weights of the edges are changing to 1. i.e., after calling parallel_sort function in kruskalApply function. i donno the reason :( it works fine for small number of nodes. iam intrested in any suggestions as well. thankyou

You only use parallel_sort from TBB . Try replacing it with std::sort and see if there is any problem with the serial version. Have it working and make it parallel later.
ktrfrk
Beginner
216 Views
Quoting - ninhngt

You only use parallel_sort from TBB . Try replacing it with std::sort and see if there is any problem with the serial version. Have it working and make it parallel later.
yea i got the same output for serial version also. the weights of the edges are changing after the sort function
ozang
Beginner
216 Views
I think you used the map in a wrong way. In maps, you have to use pairs but you use the weights as key. It seems wrong. please review this:http://www.cplusplus.com/reference/stl/map/.
Another point, you call "ed.push_back(e);" but what is ed? it is not declared.

You can give a try with TBB 3.
Reply