src/GraphCreation.c
/*
 * FUNCTION NAME: updateDataBaseFile
 *
 * DESCRIPTION:
 * Function saves connections in alphabetical
 * order in DataBase.txt file.
 */
FUNCTION NAME: updateDataBaseFile
DESCRIPTION:
Function saves connections in alphabetical
order in DataBase.txt file.
FUNCTION NAME : updateDataBaseFile DESCRIPTION : Function saves connections in alphabetical order in DataBase . txt file .
void updateDataBaseFile(const Graph_t* graph)
{
    FILE* fp;
    if ((fp = fopen("../res/DataBase.txt", "w")) == NULL) {
        printDataBaseError(CANT_UPDATE_FILE);
        return;
    }
    AdjacencyList_t* adjacency_list;
    AdjacencyListNode_t* adjacency_list_node;
    for (adjacency_list = graph->head; adjacency_list != NULL; adjacency_list = adjacency_list->next) {
        for (adjacency_list_node = adjacency_list->head; adjacency_list_node != NULL; adjacency_list_node = adjacency_list_node->next) {
            fprintf(fp, "%s %s %.2lf\n", adjacency_list->from, adjacency_list_node->to, adjacency_list_node->distance);
        }
    }
    fclose(fp);
}
void updateDataBaseFile ( const Graph_t * graph ) { FILE * fp ; if ( ( fp = fopen ( " " , " " ) ) == NULL ) { printDataBaseError ( CANT_UPDATE_FILE ) ; return ; } AdjacencyList_t * adjacency_list ; AdjacencyListNode_t * adjacency_list_node ; for ( adjacency_list = graph -> head ; adjacency_list != NULL ; adjacency_list = adjacency_list -> next ) { for ( adjacency_list_node = adjacency_list -> head ; adjacency_list_node != NULL ; adjacency_list_node = adjacency_list_node -> next ) { fprintf ( fp , " \n " , adjacency_list -> from , adjacency_list_node -> to , adjacency_list_node -> distance ) ; } } fclose ( fp ) ; }
FUNCTION NAME: updateDataBaseFile
 DESCRIPTION:
 Function saves connections in alphabetical
 order in DataBase.txt file.
FUNCTION NAME : updateDataBaseFile DESCRIPTION : Function saves connections in alphabetical order in DataBase . txt file .