Graph Drawing
Get Gephi Open Graph Viz Platform
Add code to save edges to a file. The file format must be
10000 10001
10000 10002
...
where 10000 is the port of this host and 10001 and 10002 are the ports of the this host's neighbors.
For example, the following code will make a file:
void dumpNeighbors(list<NeighborInfo> &bidirectionalNeighbors, HostId &thisHost) {
FILE *fptr;
char fn[200];
sprintf(fn,"d:\\neighborInfo%d.csv",thisHost._port);
fptr = fopen(fn,"wt");
if (fptr==0)
printf("failed to open file %s!!!!!!!!!!!!!!!!!!!!!\n",fn);
foreach(NeighborInfo neighbor, bidirectionalNeighbors) {
fprintf(fptr,"%d %d\n",thisHost._port,neighbor.hostId._port);
}
fclose(fptr);
}
and call this function every now in then (e.g., every time you send hellos)
Next, start Gephi
Open one of the files.
Then, open another fiel. However, after selecting the file and clicking ok, adialog box pops open. Select the option to append the graph.
Repeat this until all files are open.
Netx, play around with Gephi.
At the bottom, press the "T" button to show the vertex labels.
At the buttom, play with the sliders to make the fonts different
open one of the