Ciao a tutti, ho un problema con i grafi.
Voglio implementare un grafo con liste di adiacenza i cui nodi siano stringhe.

Questa è la mia struttura dati:

typedef struct node{
char *val;
struct node * next;
}node;

typedef struct graph{
int nv; // Vertici
node **adi; // Lista di adiacenza
} graph;

e questa è la mia funzione aggiungi arco:

// Funzione per l'aggiunta di un arco
// INPUT: grafo, i due nodi da collegare
// OUTPUT: void
void aggiungi(graph *g, char *u, char *v){
node *new, *n;
new = malloc(sizeof(node));
if(new == NULL)
printf("Errore");
else{
new -> val = v;
new -> next = NULL;
if (g -> adi[u] == NULL)
g -> adi[u] = new;
else{
n = g -> adi[u];
while(n -> next != NULL)
n = n -> next;
n -> next = new;
}
}
}

Avendo a che fare con puntatori di stringhe, come faccio a scorrere il mio vettore adi[]
Grazie in anticipo.