From: erg Date: Fri, 8 Apr 2011 20:03:19 +0000 (+0000) Subject: Replace maxdeg.g with richer script X-Git-Tag: LAST_LIBGRAPH~32^2~829 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2052a1631eb91da49001fdd6264fecd2036b3ea;p=graphviz Replace maxdeg.g with richer script --- diff --git a/cmd/gvpr/lib/maxdeg.g b/cmd/gvpr/lib/maxdeg.g index c63535bc9..c61f2313c 100644 --- a/cmd/gvpr/lib/maxdeg.g +++ b/cmd/gvpr/lib/maxdeg.g @@ -1,4 +1,10 @@ -/* find node of max degree */ -BEGIN {node_t n; int maxd = -1; } -N { if (degree > maxd) {maxd = degree; n = $;} } -END {printf ("max degree = %d, node %s\n", maxd, n.name)} +/* find nodes of max and min degree */ +BEG_G {node_t mxn, mnn; int maxd = -1; int mind = 1000000;} +N { +if (degree > maxd) +{maxd = degree; mxn = $;} +if (degree < mind) +{mind = degree; mnn = $;} +} +END_G {printf ("max degree = %d, node %s, min degree = %d, node %s\n", + maxd, mxn.name, mind, mnn.name)}