PDA

View Full Version : [C] trovare clique in un grafo


noodles83
11-03-2008, 17:14
Ragazzi devo implementare delle funzioni per la gestione di un grafo usando liste di adiacenza e fino a qui ok. Ho già implementato la maggior parte delle funzioni senza grossi problemi.

queste le strutture usate:
/** elemento lista di adiacenza */
typedef struct edge {
/** etichetta nodo adiacente */
int label;
/** prossima adiacenza*/
struct edge * next;
} edge_t;

/** nodo del grafo */
typedef struct node {
/** etichetta */
int label;
/** grado (numero nodi adiacenti) */
int degree;
/** lista di adiacenza */
edge_t * adj;
/** prossimo nodo */
struct node * next;
} node_t;

/** Grafo non-orientato rappresentato con liste di adiacenza.
*/
typedef struct graph {
/** lista dei nodi */
node_t * nodes;
/** numero nodi */
int n_size;
/** numero archi */
int e_size;
} graph_t;

/** numero nodi clique */
#define CLIQUESIZE 3
/** 3-clique rappresentata come array di nodi */
typedef int clique_t[CLIQUESIZE];

la funzione che devo implementare è questa:
/** trova le 3-clique in un grafo
\param g puntatore al grafo
\param c array dove memorizzare le 3-clique
\param l lunghezza array \c c

\retval -1 se si e' verificato un errore (imposta errno)
\retval p (p>=0) numero di clique trovate
*/
int find_cliques(graph_t* g, clique_t* c,int l);

praticamente devo trovare le clique formate da tre nodi e memorizzarle in un array...

consigli? :confused:

noodles83
12-03-2008, 19:03
up

noodles83
14-03-2008, 19:09
nessuno? :confused:

Hardware Upgrade Forum Database Error
Database Error Database error
The Hardware Upgrade Forum database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.hwupgrade.it home page, then try to open another page.
  • Click the Back button to try another link.
The www.hwupgrade.it forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.