From f2052a1631eb91da49001fdd6264fecd2036b3ea Mon Sep 17 00:00:00 2001 From: erg Date: Fri, 8 Apr 2011 20:03:19 +0000 Subject: [PATCH] Replace maxdeg.g with richer script --- cmd/gvpr/lib/maxdeg.g | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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)} -- 2.40.0