Page principale   Liste des composants   Liste des fichiers   Composants   Déclarations  

graphes.h

Aller à la documentation de ce fichier.
00001 
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <string.h>
00007 #include <math.h>
00008 
00009 #define TYP_VARC long
00010 #define TYP_VSOM long
00011 #ifndef HUGE
00012 #define HUGE HUGE_VAL
00013 #endif
00014 #define SHRT_MIN -32767 
00015 #define SHRT_MAX +32767 
00016 #define USHRT_MAX 65535 
00017 #define INT_MIN -32767 
00018 #define INT_MAX +32767 
00019 #define UINT_MAX 65535 
00020 #define LONG_MIN -2147483647 
00021 #define LONG_MAX +2147483647
00022 #define ULONG_MAX 4294967295
00023 #define M_PI     3.14159265358979323846
00024 #define max(X,Y) ((X)>=(Y)?(X):(Y))
00025 #define min(X,Y) ((X)<=(Y)?(X):(Y))
00026 
00027 /* ================================================ */
00028 /* types publics */
00029 /* ================================================ */
00030 
00034 typedef struct cell {
00036   int som;
00038   TYP_VARC v_arc; 
00040   struct cell * next; 
00041 } cell;
00042 
00046 typedef cell * pcell; 
00047 
00048 
00052 typedef struct graphe {
00053 
00054   /* informations globales */
00055 
00057   int nsom;         
00059   int nmaxarc;      
00061   int narc;         
00062 
00063   /* representation par listes chainees de successeurs (application gamma) */
00064 
00066   pcell reserve;    
00068   pcell libre;      
00070   pcell * gamma;    
00071 
00072   /* representation par liste d'arcs 
00073      (vecteurs tete (sommet initial), queue (sommet final)) */
00074 
00076   int *tete;        
00078   int *queue;       
00079 
00080   /* informations additionelles ajoutees aux arcs */
00081 
00083   TYP_VARC *v_arcs;
00084 
00085   /* informations additionelles ajoutees aux sommets */
00086 
00088   TYP_VSOM *v_sommets;
00089 
00091   double *x;        
00093   double *y;        
00095   char **nomsommet; 
00096 } graphe;
00097 
00098 /* ================================================ */
00099 /* prototypes */
00100 /* ================================================ */
00101 
00102 extern void AfficheEnsemble(boolean *s, int n);
00103 extern void AfficheListe(pcell p);
00104 extern void AfficheSuccesseurs(graphe * g) ;
00105 extern void AfficheArcs(graphe * g);
00106 extern void AfficheValeursSommets(graphe * g);
00107 extern void PSGraphe(graphe * g, char *filename, double r, double t, double marge);
00108 void EPSGraphe(graphe * g, char *filename, double r, double t, double marge, int noms_sommets, int v_sommets, int col_sommets, int v_arcs);
00109 
00110 /* ====================================================================== */
00111 /* ====================================================================== */
00112 /* FONCTIONS DE PLONGEMENT DE GRAPHES DANS LE PLAN */
00113 /* ====================================================================== */
00114 /* ====================================================================== */
00115 
00116 extern void AutoNomsSommets(graphe * g, int mode);
00117 extern void PlongementCirculaire(graphe * g, double r);
00118 extern void PlongementRadial(graphe * g, int c);
00119 
00120 /* ====================================================================== */
00121 /* ====================================================================== */
00122 /* FONCTIONS SUR LES LISTES CHAINEES DE SOMMETS */
00123 /* ====================================================================== */
00124 /* ====================================================================== */
00125 
00126 extern pcell AlloueCell(pcell * plibre);
00127 extern void LibereCell(pcell * plibre, pcell p);
00128 extern void RetireTete(pcell * plibre, pcell * pliste);
00129 extern void AjouteTete(pcell * plibre, pcell * pliste, int a, TYP_VARC v);
00130 extern int EstDansListe(pcell p, int a);
00131 
00132 /* ====================================================================== */
00133 /* ====================================================================== */
00134 /* FONCTIONS D'ALLOCATION / LIBERATION POUR UN GRAPHE */
00135 /* ====================================================================== */
00136 /* ====================================================================== */
00137 
00138 extern graphe * InitGraphe(int nsom, int nmaxarc);
00139 extern void TermineGraphe(graphe * g);
00140 extern graphe * ReadGraphe(char * filename);
00141 
00142 /* ====================================================================== */
00143 /* ====================================================================== */
00144 /* FONCTIONS DE MANIPULATION DES ARCS (APPLICATION GAMMA UNIQUEMENT) */
00145 /* ====================================================================== */
00146 /* ====================================================================== */
00147 
00148 extern void AjouteArc(graphe * g, int i, int s);
00149 extern void AjouteArcValue(graphe * g, int i, int s, TYP_VARC v);
00150 extern void RetireArc(graphe * g, int i, int s);
00151 extern int PopSuccesseur(graphe *g, int i);
00152 extern int EstSuccesseur(graphe *g, int i, int s);
00153 
00154 /* ====================================================================== */
00155 /* ====================================================================== */
00156 /* FONCTIONS DE GENERATION DE GRAPHES */
00157 /* ====================================================================== */
00158 /* ====================================================================== */
00159 
00160 extern graphe * GrapheAleatoire(int nsom, int narc);
00161 
00162 /* ====================================================================== */
00163 /* ====================================================================== */
00164 /* OPERATEURS DE BASE SUR LES GRAPHES */
00165 /* ====================================================================== */
00166 /* ====================================================================== */
00167 
00168 extern graphe * Symetrique(graphe * g);
00169 extern graphe * FermetureSymetrique(graphe * g);
00170 extern void CompFortConnexe(graphe * g, graphe *g_1, int a, boolean * Ca);
00171 extern boolean ExisteCircuit(graphe * g, int a);
00172 extern void CompConnexe(graphe * g, graphe *g_1, int a, boolean * Ca);
00173 extern boolean Connexe(graphe * g, graphe *g_1);
00174 
00175 /* ====================================================================== */
00176 /* ====================================================================== */
00177 /* ARBRE DE POIDS MAXIMUM */
00178 /* ====================================================================== */
00179 /* ====================================================================== */
00180 
00181 extern graphe * Kruskal1(graphe * g, graphe *g_1);
00182 extern graphe * Kruskal2(graphe * g, graphe *g_1);
00183 
00184 /* ====================================================================== */
00185 /* ====================================================================== */
00186 /* PLUS COURTS CHEMINS */
00187 /* ====================================================================== */
00188 /* ====================================================================== */
00189 
00190 extern void Dijkstra(graphe * g, int i);
00191 extern graphe * PCC(graphe * g, int d, int a);

Généré le Fri Jun 7 07:25:53 2002 pour Graphes par doxygen1.2.12 écrit par Dimitri van Heesch, © 1997-2001