I am working on a project where I can trace out a specific IP address from 10-15 different IP addresses. I am here. Most tracers go with a few routers on the same destination (hop). As a result the data gives me a graph I think the best way to represent this data is an adjacent list. Is there any C library where I can get an example of such a graph and I call different traceroutes to the hops?
#include < Stdio.h & gt; # Include & lt; Stdlib.h & gt; // Attachment list The implementation of the graph using the associated list in the composition adjnnode {int index; Structure adj_node * next; }; Zero Modes (structure adjnnode * nod, int adj) {struct adj_node * newadj = (structure adj_node *) malloc (sizeof (struct adjnnode)); Newadj- & gt; Index = adj; Newadj- & gt; Next = zero; While (nod-> Next = zero) Approval = nod-> Next; Nod-> Next = newadj; } Int main () {int i; Structure adj_node graph [4], * temp; For (i = 0; i <4; i ++) {article [i] .index = i; Graph [i] .next = NULL; } // example medage (& amp; graph [0], 2); Makeadj (& amp; graph [0], 3); Makeadj (& amp; graph [1], 2); Makeadj (& amp; graph [2], 0); Makeadj (& amp; graph [2], 1); Makeadj (& amp; graph [2], 3); Floating = & amp; Graph [2]; While (temp-> Next! = NULL) {printf ("% d", temp-> gt; Next-> Index); Temporary = temp-> Next; } Return 0; }
Comments
Post a Comment