Why is there a segmentation fault in the code?

This is the code for MSP using Kruskal’s Algo: https://ide.codingblocks.com/s/260297

hello @anushreemahur5
image
u r using indexing on vector edges,
for that u edges vector should be of size m

so u should declare ur edge vector as
vector < vector< int > > edges(m);