Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have an assignment to convert adjacency lists to adjacency matrices and vice v

ID: 3646541 • Letter: I

Question

I have an assignment to convert adjacency lists to adjacency matrices and vice versa. I believe I have done so, however, the sample output given differs slightly from my output. In the sample output given from the professor the nodes in the adjacency lists are not all in increasing order like mine. I am wondering do the order of the nodes in an adjacency list signify something, or is just the fact that they belong to same set of numbers mean the lists are equivalent? Here's my output and the professors if it helps clarify my question: (I AM PUTTING WHAT THE INPUT SIGNIFIES IN PARENTHESIS TO MAKE IT CLEARER) SAMPLE INPUT: 1 (CONVERT MATRIX TO LIST) 4 (# OF VERTICES) 0 0 1 0 (THE MATRIX TO CONVERT) 0 0 1 1 (..) 1 1 0 1 (..) 0 1 1 0 (..) 2 (CONVERT LIST TO MATRIX) 6 (# OF VERTICES) 2 (# OF ADJACENT NODES) 1 4 (THE ADJACENT NODES) 3 (..) 2 0 5 (..) 2 (..) 1 3 (..) 2 (..) 2 4 (..) 3 (..) 5 0 3 (..) 2 (..) 4 1 (..) --- THE OUTPUT FOLLOWS THE SAME FORMAT AS THE INPUT EXCEPT THE NUMBER OF VERTICES IS LISTED FOLLOWED BY THE CONVERTED LIST OR MATRIX --- MY OUTPUT: 4 1 2 2 2 3 3 0 1 3 2 1 2 6 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 PROFESSORS OUTPUT: 4 1 2 2 2 3 3 0 1 3 2 2 1 (!!!!!!! <-- notice the teacher has 2 1 and I have 1 2) 6 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0

Explanation / Answer

I am guessing that this is for an algorithm class? This is just my five cents but I would say no. It would not change anything when traversing the net or using bfs or dfs search in the net. However if the nodes have additional information like we would order the internet - page ranking algorithm - then I personally would like to order the nodes by weight/ranking number. Like I said this is just my five cents but to be on the safe side I would post this fun question on stackoverflow.com just be sure to mark it homework so they know how to answer it, if you do so please post the link here, I would love to see the answer if it differs from mine. Good luck with the assignment

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote