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

Généré le Wed Jan 12 09:48:57 2005 pour Graphes par doxygen1.2.18