Help, i'm losing my mind. I'm not sure where i'm going wrong in this function, it gives me an error on every line of check50 after sort pairs. Can anybody shed any light? Thank you in advance! J
// Lock pairs into the candidate graph in order, without creating cycles
void lock_pairs(void)
{
int cycle = 0;
for (int i = 0; i < pair_count; i++)
{
if (i == 0)
{
// if pair 0, lock the pair as it is strongest margin
locked[pairs[i].winner][pairs[i].loser] = true;
}
else if (locked[pairs[i].winner][pairs[i].loser] == false)
{
//(if pair is unlocked) check for cycle
for (int j = 0; j < pair_count; j++)
{
//check if the winner is locked[j][winner]
if (locked[j][pairs[i].winner] == true)
{
printf("cycle detected, did not lock\n\n");
cycle = 1;
}
}
}
if (cycle == 0)
{
printf("no cycle detected\n\n");
locked[pairs[i].winner][pairs[i].loser] = true;
}
}
return;
}