.SH NAME
gvpr \- graph pattern scanning and processing language
.br
-( previously known as
-.B gpr
-)
.SH SYNOPSIS
.B gvpr
[\fB\-icnqV?\fP]
]
.SH DESCRIPTION
.B gvpr
+(previously known as
+.BR gpr )
is a graph stream editor inspired by \fBawk\fP.
It copies input graphs to its
output, possibly transforming their structure and attributes,
the next \fBBEG_G\fP statement, if any.
The top\(hylevel semantics of a \fBgvpr\fP program are:
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
Evaluate the \fBBEGIN\fP clause, if any.
or an array, or an executable statement. For declarations, there
is a single scope. Array declarations have the form:
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fI type array \fB[\fP type0 \fB]\fR
context.
.PP
Executable statements can be one of the following:
-.ta \w'\f(CWdelete array[expression]'u
.RS
-.nf
+.TS
+l l.
\fB{\fR [\fI statement ... \fR] \fB}\fR
\fIexpression\fP \fR// commonly\fP\fI var \fB=\fP expression\fR
\fBif(\fI expression \fP)\fI statement \fR[ \fBelse\fI statement \fR]
\fBbreak [\fI expression \fP]
\fBcontinue [\fI expression \fP]
\fBreturn [\fI expression \fP]\fR
-.fi
+.TE
.RE
.SM
Items in brackets are optional.
for the role of \fB$tvroot\fP.
.SH EXAMPLES
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fBgvpr \-i 'N[color=="blue"]' file.gv\fP
.PP
Generate the node\(hyinduced subgraph of all nodes with color blue.
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fBgvpr \-c 'N[color=="blue"]{color = "red"}' file.gv\fP
.PP
Make all blue nodes red.
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fBBEGIN { int n, e; int tot_n = 0; int tot_e = 0; }
.PP
Version of the program \fBgc\fP.
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fBgvpr \-c ""\fP
.PP
Equivalent to \fBnop\fP.
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fBBEG_G { graph_t g = graph ("merge", "S"); }
Produces a strict version of the input graph, where the weight attribute
of an edge indicates how many edges from the input graph the edge represents.
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fBBEGIN {node_t n; int deg[]}
.PP
Computes the degrees of nodes with edges.
.PP
-.ta \w'\f(CWdelete array[expression]'u
.RS
.nf
\fBBEGIN {
AC_CHECK_PROG(EGREP,egrep,egrep,false)
AC_CHECK_PROG(GROFF,groff,groff,false)
+AC_CHECK_PROG(TBL,tbl,tbl,false)
AC_CHECK_PROG(PS2PDF,ps2pdf,ps2pdf,false)
AC_CHECK_PROG(PS2PDF,pstopdf,pstopdf,false)