src/GraphCreation.c
/*
 * FUNCTION NAME: updateOrdinalNumbers
 *
 * DESCRIPTION:
 * Function updates cities' ordinal numbers in the graph.
 */
FUNCTION NAME: updateOrdinalNumbers
DESCRIPTION:
Function updates cities' ordinal numbers in the graph.
FUNCTION NAME : updateOrdinalNumbers DESCRIPTION : Function updates cities ' ordinal numbers in the graph .
void updateOrdinalNumbers(Graph_t* graph)
{
    AdjacencyList_t *upper, *compare;
    AdjacencyListNode_t* lower;
    unsigned int ordinal_number = 0;
    for (upper = graph->head; upper != NULL; upper = upper->next) {
        upper->ordinal_number = ordinal_number++;
    }
    for (upper = graph->head; upper != NULL; upper = upper->next) {
        for (lower = upper->head; lower != NULL; lower = lower->next) {
            for (compare = graph->head; compare != NULL; compare = compare->next) {
                if (strcmp(lower->to, compare->from) == 0) {
                    lower->ordinal_number = compare->ordinal_number;
                    break;
                }
            }
        }
    }
}
void updateOrdinalNumbers ( Graph_t * graph ) { AdjacencyList_t * upper , * compare ; AdjacencyListNode_t * lower ; unsigned int ordinal_number = 0 ; for ( upper = graph -> head ; upper != NULL ; upper = upper -> next ) { upper -> ordinal_number = ordinal_number ++ ; } for ( upper = graph -> head ; upper != NULL ; upper = upper -> next ) { for ( lower = upper -> head ; lower != NULL ; lower = lower -> next ) { for ( compare = graph -> head ; compare != NULL ; compare = compare -> next ) { if ( strcmp ( lower -> to , compare -> from ) == 0 ) { lower -> ordinal_number = compare -> ordinal_number ; break ; } } } } }
FUNCTION NAME: updateOrdinalNumbers
 DESCRIPTION:
 Function updates cities' ordinal numbers in the graph.
FUNCTION NAME : updateOrdinalNumbers DESCRIPTION : Function updates cities ' ordinal numbers in the graph .
/* Firstly, set ordinal numbers in the "upper" list. */ /* Then, set ordinal numbers in "lower" lists. */ /* Firstly, take an element from "upper" list. */ /* Then take an element from "lower" list. */ /* Then search for element in "upper" list that matches an element
             * from "lower" list. */ /* If names are identical (elements are matched) then update the
                 * ordinal number in element from "lower" list to the same ordinal number
                 * as in "upper" list. */