Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
R
RDM_grands_graphes
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Louis FOURCADE
RDM_grands_graphes
Validations
c558dfb3
Valider
c558dfb3
rédigé
4 years ago
par
Samuh
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
question 3 TP4
parent
03b76617
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
TP4.c
+25
-7
25 ajouts, 7 suppressions
TP4.c
avec
25 ajouts
et
7 suppressions
TP4.c
+
25
−
7
Voir le fichier @
c558dfb3
...
...
@@ -142,7 +142,8 @@ void aff_tab(unsigned long *t, int size)
// -----------------------------------------------------------------------------------------------------------------------------------------
void
simplifie_label
(
unsigned
long
*
label
,
unsigned
long
size
)
// renvoie le nombre de label et les renommes
unsigned
long
simplifie_label
(
unsigned
long
*
label
,
unsigned
long
size
)
{
unsigned
long
c
=
0
;
unsigned
long
smallest
=
size
;
...
...
@@ -168,6 +169,7 @@ void simplifie_label(unsigned long *label, unsigned long size)
}
c
++
;
}
return
c
-
1
;
}
void
output_graphe
(
adjlist
*
g
,
unsigned
long
*
label
,
char
*
filename
)
...
...
@@ -255,7 +257,7 @@ int main(int argc, char **argv)
}
adjlist
*
g
;
time_t
t1
,
t2
,
t3
;
time_t
t1
,
t2
,
t3
,
t4
;
// PARSING
t1
=
time
(
NULL
);
...
...
@@ -263,8 +265,11 @@ int main(int argc, char **argv)
printf
(
"Reading edgelist from file %s
\n
"
,
argv
[
1
]);
g
=
al_readedgelist
(
argv
[
1
]);
t3
=
time
(
NULL
);
printf
(
"- edge list time = %ldh%ldm%lds
\n
"
,(
t3
-
t1
)
/
3600
,((
t3
-
t1
)
%
3600
)
/
60
,((
t3
-
t1
)
%
60
));
// printf("- edge list time = %I64dh%I64dm%I64ds\n", (t3 - t1) / 3600, ((t3 - t1) % 3600) / 60, ((t3 - t1) % 60));
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
printf
(
"- edge list time = %I64dh%I64dm%I64ds
\n
"
,
(
t3
-
t1
)
/
3600
,
((
t3
-
t1
)
%
3600
)
/
60
,
((
t3
-
t1
)
%
60
));
#else
printf
(
"- edge list time = %ldh%ldm%lds
\n
"
,
(
t3
-
t1
)
/
3600
,
((
t3
-
t1
)
%
3600
)
/
60
,
((
t3
-
t1
)
%
60
));
#endif
printf
(
"Number of nodes: %lu
\n
"
,
g
->
n
);
printf
(
"Number of edges: %lu
\n
"
,
g
->
e
);
...
...
@@ -274,18 +279,31 @@ int main(int argc, char **argv)
t2
=
time
(
NULL
);
printf
(
"- Overall time = %ldh%ldm%lds
\n
"
,(
t2
-
t1
)
/
3600
,((
t2
-
t1
)
%
3600
)
/
60
,((
t2
-
t1
)
%
60
));
// printf("- Overall time = %I64dh%I64dm%I64ds\n", (t2 - t1) / 3600, ((t2 - t1) % 3600) / 60, ((t2 - t1) % 60));
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
printf
(
"- Overall time = %I64dh%I64dm%I64ds
\n
"
,
(
t2
-
t1
)
/
3600
,
((
t2
-
t1
)
%
3600
)
/
60
,
((
t2
-
t1
)
%
60
));
#else
printf
(
"- Overall time = %ldh%ldm%lds
\n
"
,
(
t2
-
t1
)
/
3600
,
((
t2
-
t1
)
%
3600
)
/
60
,
((
t2
-
t1
)
%
60
));
#endif
srand
(
time
(
NULL
));
unsigned
long
*
res
=
label_propagation
(
g
);
simplifie_label
(
res
,
g
->
n
);
t4
=
time
(
NULL
);
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
printf
(
"- label_propagation time = %I64dh%I64dm%I64ds
\n
"
,
(
t4
-
t2
)
/
3600
,
((
t4
-
t2
)
%
3600
)
/
60
,
((
t4
-
t2
)
%
60
));
#else
printf
(
"- label_propagation time = %ldh%ldm%lds
\n
"
,
(
t4
-
t2
)
/
3600
,
((
t4
-
t2
)
%
3600
)
/
60
,
((
t4
-
t2
)
%
60
));
#endif
unsigned
long
nb
=
simplifie_label
(
res
,
g
->
n
);
printf
(
"%li label different
\n
"
,
nb
);
output_graphe
(
g
,
res
,
"toto.dot"
);
printf
(
"run {dot -Tpng -o out.png toto.dot} pour avoir une visualisation de la solution
\n
"
);
free
(
res
);
free_adjlist
(
g
);
return
0
;
}
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter