2nd for loop in Graph

Could not understand the 2nd for loop

Hey @Naivedh
Hope you’re enjoying the course
So the 2nd loop is used to push edges into the adjacency list matrix representation.
So if you get an edge (4,2,8) as input
4 is node1
2 is node2
These nodes are end points
8 is weight of edge

so you push (2,8) to list of 4
and you push (4,8) to list of 2

And since we’re using 0 based indexing while input is 1 based indexing so subtract 1 from all nodes/vertices but not weights
we did list 1 push -> (3,8)
we did list 3 push -> (2,8)