%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /usr/share/graphviz/gvpr/ |
Upload File : |
/* Report the distance from src = ARGV[0] to dst = ARGV[1]
*/
BEG_G {
int dist[node_t];
node_t n, curn;
node_t src = node($G, ARGV[0]);
node_t dst = node($G, ARGV[1]);
$tvroot = src;
$tvtype = TV_bfs;
}
N {
curn = $;
if ($ == dst) {
printf ("dist from %s to %s is %d\n", src.name, dst.name, dist[dst]);
exit(0);
}
}
E {
if ($.head == curn) n = $.tail;
else n = $.head;
if (dist[n] == 0) dist[n] = dist[curn]+1;
}