CARS
|
test shortest path More...
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <mcheck.h>
#include "dgraph.h"
#include "shortestpath.h"
Defines | |
#define | NODESFILE "./CITY.txt" |
#define | ARCSFILE "./TUSCANY.map" |
Functions | |
static void | stampadist (graph_t *g, int n, double *dist) |
static void | stampaprec (graph_t *g, int n, unsigned int *prec) |
static void | calcola_e_stampa_rotte (graph_t *g, unsigned int n1, unsigned int *prec) |
int | main (void) |
Variables | |
static char * | citta [] |
static char * | strade [] |
test shortest path
#define ARCSFILE "./TUSCANY.map" |
file dati mappa toscana: file archi
Referenced by main().
#define NODESFILE "./CITY.txt" |
file dati mappa toscana: file nodi
Referenced by main().
static void calcola_e_stampa_rotte | ( | graph_t * | g, |
unsigned int | n1, | ||
unsigned int * | prec | ||
) | [static] |
stampa in formato stringa le rotte da n1 a tutti gli altri nodi del grafo
g | grafo di riferimento |
n1 | nodo di partenza delle rotte |
prec | vettore delle precedenze calcolato da dijkstra |
References shpath_to_string().
Referenced by main().
int main | ( | void | ) |
main function
References add_edge(), ARCSFILE, calcola_e_stampa_rotte(), citta, dijkstra(), free_graph(), load_graph(), new_graph(), NODESFILE, graph::size, stampadist(), stampaprec(), and strade.
static void stampadist | ( | graph_t * | g, |
int | n, | ||
double * | dist | ||
) | [static] |
stampa formattata del vettore delle distanze calcolato da dijkstra()
g | grafo di riferimento |
n | nodo di partenza |
dist | vettore delle distanze in km |
References INFINITY, and graph::size.
Referenced by main().
static void stampaprec | ( | graph_t * | g, |
int | n, | ||
unsigned int * | prec | ||
) | [static] |
stampa formattata del vettore delle precedenze calcolato da dijkstra()
g | grafo di riferimento |
n | nodo di partenza |
prec | vettore delle precedenze |
References graph::size.
Referenced by main().
char* citta[] [static] |
{ "PISA", "LUCCA", "LIVORNO", "LA SPEZIA", "AREZZO", "PRATO", "FIRENZE", NULL, }
nodi primo grafo di test
Referenced by main().
char* strade[] [static] |
{ "PRATO:FIRENZE:24.9", "PISA:LUCCA:24.8", "LUCCA:PISA:24.8", "PISA:LIVORNO:22.3", "LIVORNO:PISA:22.3", "LA SPEZIA:PISA:80.0", "PISA:LA SPEZIA:80.0", "FIRENZE:AREZZO:77.9", "AREZZO:FIRENZE:77.9", "PRATO:LUCCA:57.9", "LUCCA:PRATO:57.9", "FIRENZE:PRATO:24.9", NULL, }
archi primo grafo di test
Referenced by main().