int main(){ Graphe g = initGraphe(3); ajouterArc(0,1,0.5f,g); ajouterArc(0,2,0.6f,g); afficherGraphe(g); deleteGraphe(g); return 0; }
// initialisation des noeuds a partir du fichier xml int setnode(call_t *c, void *params) { struct nodedata *nodedata = malloc(sizeof(struct nodedata)); struct protocoleData *entitydata = malloc(sizeof(struct protocoleData)); nodedata->overhead = -1; nodedata->oneHopNeighbourhood = 0; nodedata->twoHopNeighbourhood = 0; nodedata->g2hop = malloc(sizeof(graphe)); initGraphe(nodedata->g2hop, c->node); nodedata->BIP_tree = 0; nodedata->nbr_evenement = 0; //STATS nodedata->lastIDs = malloc(get_node_count()*sizeof(int)); nodedata->energiesRem = malloc(get_node_count()*sizeof(double)); set_node_private_data(c, nodedata); SHOW_GRAPH("N: %d %lf %f\n",c->node,get_node_position(c->node)->x,get_node_position(c->node)->y); // printf("Node %d at ( %.1lf ; %.1lf ; %.1lf )\n", c->node,get_node_position(c->node)->x,get_node_position(c->node)->y,get_node_position(c->node)->z); return 0; }