We study the statistical properties of the scattering matrix associated wit
h generic quantum graphs. The scattering matrix is the quantum analogue of
the classical evolution operator on the graph. For the energy-averaged spec
tral form factor of the scattering matrix we have recently derived an exact
combinatorial expression. It is based on a sum over families of periodic o
rbits which so Far could only be performed in special graphs. Here we prese
nt a simple algorithm implementing this summation for any graph. Our result
s are in excellent agreement with direct numerical simulations for various
graphs. Moreover, we extend our previous notion of an ensemble of graphs by
considering ensemble averages over random boundary conditions imposed at t
he vertices. We show numerically that the corresponding form factor follows
the predictions of random-matrix theory when the number of vertices is lar
ge - even when all bond lengths are degenerate. The corresponding combinato
rial sum has a structure similar to the one obtained previously by performi
ng an energy average under the assumption of incommensurate bond lengths. (
C) 2001 Elsevier Science B.V. All rights reserved.