Feel free to use these lines as you wish. These programs load a graph in main memory as (i) a list of edges, (ii) an adjacency matrix or (iii) an adjacency list.
## To compile:
"gcc edgelist.c -O9 -o edgelist"
"gcc adjmatrix.c -O9 -o adjmatrix"
"gcc adjarray.c -O9 -o adjarray"
make
should compile on any UNIX based system
## To execute:
"./edgelist edgelist.txt"
"./adjmatrix edgelist.txt"
"./adjarray edgelist.txt"
## To execute:
"edgelist.txt" should contain the graph: one edge on each line (two unsigned long (nodes' ID) separated by a space).
The program will load the graph in main memory and then terminate.
./TP1 'path to a graph file'
## Performance:
./TP2 'path to a graph file'
- edgelist: up to 500 million edges on my laptop with 8G of RAM. Takes more or less 1.6G of RAM and 25 seconds (I have an SSD hardrive) for 100M edges.
- adjmatrix: up to 200.000 nodes on my laptop with 8G of RAM. Takes more or less 4G of RAM and 10 seconds for 100.000 nodes.
- adjlist: up to 200 million edges on my laptop with 8G of RAM: takes more or less 4G of RAM and 30 seconds for 100M edges.
./TP3 'path to a graph file' /!\ TP3 should have files "alr21--pageCategList--enwiki--20071018.txt" and file "alr21--categDAG--dirLinks--enwiki-20071018.txt" (found at : http://cfinder.org/wiki/?n=Main.Data#toc1) in the safe folder as the executable for EXERCISE 3 to work properly
adjmatrix is much less scallable than the two other programs for sparse graphs. adjmatrix uses O(n^2) memory (n^2 boolean values (note that adjmatrix uses 1 byte to encode a boolean value and not 1 bit...)), while edgelist uses O(m) (2m unsigned) and adjlist uses O(m+n) (4m+2n unsigned).
./TP4 'path to a graph file'
## Note:
If the graph is directed (and weighted) with selfloops and you want to make it undirected unweighted without selfloops, use the following linux command line.