  Graph analytics elicits insights from large graphs to inform critical
decisions for business, safety and security. Several large-scale graph
processing frameworks feature efficient runtime systems; however, they often
provide programming models that are low-level and subtly different from each
other. Therefore, end users can find implementation and specially optimization
of graph analytics time-consuming and error-prone. This paper regards the
abstract interface of the graph processing frameworks as the instruction set
for graph analytics, and presents Grafs, a high-level declarative specification
language for graph analytics and a synthesizer that automatically generates
efficient code for five high-performance graph processing frameworks. It
features novel semantics-preserving fusion transformations that optimize the
specifications and reduce them to three primitives: reduction over paths,
mapping over vertices and reduction over vertices. Reductions over paths are
commonly calculated based on push or pull models that iteratively apply kernel
functions at the vertices. This paper presents conditions, parametric in terms
of the kernel functions, for the correctness and termination of the iterative
models, and uses these conditions as specifications to automatically synthesize
the kernel functions. Experimental results show that the generated code matches
or outperforms hand-optimized code, and that fusion accelerates execution.
