I am trying to fix a method that takes a function that takes a root of a linked list and the number of vertices in a graph and organizes the linked list into an array of linked list based on the first vertex of an edge struct, for example, in a struct where an node Edge has firVertex = 1, sndVertex = 2, and weight = 2, it would be sorted into the first element of an array. and another node Edge that has another firVertex = 1 would be appended onto the previous one, and etc. I have fixed it many times but it is still giving a segmentation fault when running.
Thanks for the tips, really appreciate it. Unfortunately, I cannot leave the code up since its a school assignment.