A collection of useful comparators and print functions. More...
#include <assert.h>#include <stdio.h>#include <time.h>#include <sys/resource.h>#include "misc.h"#include "LinkedList.h"#include "MemoryManager.h"Functions | |
| int | nodeComparator (void *node1, void *node2) |
| compare integers return -1,0,1 for <,=,> | |
| int | sortComparator (void *node1, void *node2) |
| compare integer pointers; return -1,0,1 for <,=,>; used for calling sort(). | |
| void | printArray (int *array, int size) |
| print an array of integers to standard out. | |
| void | printArrayOfLinkedLists (LinkedList **listOfLists, int size) |
| print an abbreviated version of an adjacency list | |
| void | printClique (int *clique) |
| print a clique, that is formatted as an integer array ending with -1. | |
| void | printInt (void *integer) |
| print an integer | |
| void | destroyCliqueResults (LinkedList *cliques) |
| destroy a linked list of integer arrays that have -1 in the last cell, have have been allocated by the user. | |
| LinkedList ** | readInGraphAdjList (int *n, int *m) |
| read in a graph from stdin and return an adjacency list, as an array of linked lists of integers. | |
| void | runAndPrintStatsMatrix (long(*function)(char **, LinkedList *, int), const char *algName, char **adjMatrix, LinkedList *cliques, int n) |
| execute an maximal clique listing algorithm that takes an adjacency matrix as input, time it, and print the number of maximal cliques found along with time information. | |
| void | runAndPrintStatsListList (long(*function)(LinkedList **, int **, LinkedList *, int *, int), const char *algName, LinkedList **adjListLinked, int **adjListArray, LinkedList *cliques, int *degree, int n) |
| execute an maximal clique listing algorithm that takes an adjacency list as input, time it, and print the number of maximal cliques found along with time information. | |
| void | processClique (LinkedList *cliques, LinkedList *clique) |
| process a clique, which may include printing it in one of several formats and/or adding the clique to a linked list. | |
A collection of useful comparators and print functions.
Copyright (c) 2011 Darren Strash. This code is released under the GNU Public License (GPL) 3.0.
| void destroyCliqueResults | ( | LinkedList * | cliques | ) |
destroy a linked list of integer arrays that have -1 in the last cell, have have been allocated by the user.
| cliques | the linked list of integer arrays |
| int nodeComparator | ( | void * | node1, | |
| void * | node2 | |||
| ) |
compare integers return -1,0,1 for <,=,>
| node1 | an integer | |
| node2 | an integer |
| void printArray | ( | int * | array, | |
| int | size | |||
| ) |
print an array of integers to standard out.
| array | the array to print | |
| size | the length of the array |
| void printArrayOfLinkedLists | ( | LinkedList ** | listOfLists, | |
| int | size | |||
| ) |
print an abbreviated version of an adjacency list
| listOfLists | the adjacency list | |
| size | the number of vertices in the graph |
| void printClique | ( | int * | clique | ) |
print a clique, that is formatted as an integer array ending with -1.
| clique | the clique. |
| void printInt | ( | void * | integer | ) |
print an integer
| integer | an integer cast to a void* |
| void processClique | ( | LinkedList * | cliques, | |
| LinkedList * | clique | |||
| ) | [inline] |
process a clique, which may include printing it in one of several formats and/or adding the clique to a linked list.
| cliques | A linked list of cliques to return. (only available when compiled with RETURN_CLIQUES_ONE_BY_ONE defined) | |
| clique | the clique to add to the linked list |
| LinkedList** readInGraphAdjList | ( | int * | n, | |
| int * | m | |||
| ) |
read in a graph from stdin and return an adjacency list, as an array of linked lists of integers.
| n | this will be the number of vertices in the graph when this function returns. | |
| m | this will be 2x the number of edges in the graph when this function returns. |
| void runAndPrintStatsListList | ( | long(*)(LinkedList **, int **, LinkedList *, int *, int) | function, | |
| const char * | algName, | |||
| LinkedList ** | adjListLinked, | |||
| int ** | adjListArray, | |||
| LinkedList * | cliques, | |||
| int * | degree, | |||
| int | n | |||
| ) |
execute an maximal clique listing algorithm that takes an adjacency list as input, time it, and print the number of maximal cliques found along with time information.
| function | a function that computes all maximal cliques and returns the number of maximal cliques found | |
| algName | a zero-terminated character string that will be printed with the statistics of the algorithm run. | |
| adjListLinked | the input graph in the array of linked lists (adjacency list) format. | |
| adjListArray | the input graph in the array of arrays (adjacency list) format. | |
| cliques | A linked list of cliques to return. (only available when compiled with RETURN_CLIQUES_ONE_BY_ONE defined) | |
| degree | An array, indexed by vertex, containing the degree of that vertex. | |
| n | the number of vertices in the input graph |
| void runAndPrintStatsMatrix | ( | long(*)(char **, LinkedList *, int) | function, | |
| const char * | algName, | |||
| char ** | adjMatrix, | |||
| LinkedList * | cliques, | |||
| int | n | |||
| ) |
execute an maximal clique listing algorithm that takes an adjacency matrix as input, time it, and print the number of maximal cliques found along with time information.
| function | a function that computes all maximal cliques and returns the number of maximal cliques found | |
| algName | a zero-terminated character string that will be printed with the statistics of the algorithm run. | |
| adjMatrix | the input graph in the adjacency matrix format. | |
| cliques | A linked list of cliques to return. (only available when compiled with RETURN_CLIQUES_ONE_BY_ONE defined) | |
| n | the number of vertices in the input graph |
| int sortComparator | ( | void * | node1, | |
| void * | node2 | |||
| ) |
compare integer pointers; return -1,0,1 for <,=,>; used for calling sort().
| node1 | a pointer to an integer | |
| node2 | a pointer to an integer |
1.7.1