hope everyone is staying safe.
Why does it need to clear the graph of locked in pairs? (p.s. I wrote the //why 😋 )
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
Interesting. I am working on the Tideman problem now and didn't notice this block until I read your question. Let's ignore the comment that states "clear graph..." and focus only on what the code is doing. The code is basically setting each cell of the 2 dimensional array to false. I believe it is doing this not to clear the array but rather to initialize it. Note that for locked cells where the candidate is the same (e.g. Alice to Alice, Bob to Bob, Charlie to Charlie, etc...) the value should always be false. So the code above does that. The second reason I believe this is being done is to help when you are comparing values in the lock_pairs function. Logically speaking, a pair of candidates should not be locked in (i.e. should be false) unless we have a reason to mark the edge as true. So I think marking all the edges as false from the start establishes the default state. It is your code's job figure out which edges to mark as true. I could be wrong on the reasoning but this makes sense to me.