Skip to content
Extraits de code Groupes Projets
Valider 3eb79d81 rédigé par Louis Fourcade's avatar Louis Fourcade
Parcourir les fichiers

Merge remote-tracking branch 'origin/master'

parents e9e1682d 68ecc081
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -9,4 +9,8 @@ TP1 ...@@ -9,4 +9,8 @@ TP1
TP2 TP2
TP3 TP3
TP4 TP4
*.exe ./TP1
\ No newline at end of file ./TP2
./TP3
./TP4
*.exe
# README # README
## Info:
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: ## To compile:
"gcc edgelist.c -O9 -o edgelist" make
"gcc adjmatrix.c -O9 -o adjmatrix"
"gcc adjarray.c -O9 -o adjarray"
should compile on any UNIX based system
## To execute:
"./edgelist edgelist.txt" ## To execute:
"./adjmatrix edgelist.txt"
"./adjarray edgelist.txt"
"edgelist.txt" should contain the graph: one edge on each line (two unsigned long (nodes' ID) separated by a space). ./TP1 'path to a graph file'
The program will load the graph in main memory and then terminate.
## 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. ./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: 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.
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. graph files should contain the graph: one edge on each line (two unsigned long (nodes' ID) separated by a space).
awk '{if ($1<$2) print $1" "$2;else if ($2<$1) print $2" "$1}' net.txt | sort -n -k1,2 -u > net2.txt
## Initial contributors
Maximilien Danisch
September 2017
http://bit.ly/danisch
maximilien.danisch@gmail.com
Fichier supprimé
Fichier supprimé
Fichier supprimé
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter