Esempio n. 1
0
void printNeighborhoodStacks(struct NeighborhoodStacks* ns, int d)
{
    int i;
    for (i = 0; i < d+1; ++i)
    {
        printNodeList(ns->array[i],i);
    //    struct Node* pCrawl = ns->array[i].head;
    //    printf("\n Stack for neighborhood %i ", i);
    //    while (pCrawl)
    //    {
    //        printf("-> %d", pCrawl->label);
    //        pCrawl = pCrawl->next;
    //    }
    //    printf("\n");
    }
}
Esempio n. 2
0
//main ()
int main (int argC, char *argV[]) {
//Call syntax check
    if (argC != 2) {
        printf ("Usage: %s Input_filename\n", argV[0]);
        exit (1);
    }
//Main variables
    FILE *inFile = NULL, *outFile = NULL;
    node *entry = NULL, *firstNode = NULL;
    int count = 0;
    char in;
//File creation and checks
    printf ("Opening files...\n");
    createFile (&inFile, argV[1], 'r');
    createOutputFile (&outFile, argV[1]);
//Load entries into DLL
    printf ("Files opened.  Loading entries...\n");
    while (1) {
//Stop conditions
        if (((ferror (inFile)) || (feof (inFile)))) {
            break;
        }
        entry = malloc (sizeof (node));
        initializeNode (entry);
        loadEntry (entry, inFile);
        firstNode = insertNode (entry, firstNode);
        entry = NULL;
//A counter so the user has some idea of how long it will take
        if (++count % 100000 == 0) {
            printf ("%d entries ordered...\n", count);
        }
    }
    fclose (inFile);
//Write ordered list to file
    printf ("%d entries ordered.  Writing to file...\n", count);
    printNodeList (firstNode, outFile);
//Close everything and free memory
    printf ("Writen.  Closing files and freeing memory...\n");
    fclose (outFile);
    return 0;
}