  Counting the frequency of small subgraphs is a fundamental technique in
network analysis across various domains, most notably in bioinformatics and
social networks. The special case of triangle counting has received much
attention. Getting results for 4-vertex or 5-vertex patterns is highly
challenging, and there are few practical results known that can scale to
massive sizes.
  We introduce an algorithmic framework that can be adopted to count any small
pattern in a graph and apply this framework to compute exact counts for
\emph{all} 5-vertex subgraphs. Our framework is built on cutting a pattern into
smaller ones, and using counts of smaller patterns to get larger counts.
Furthermore, we exploit degree orientations of the graph to reduce runtimes
even further. These methods avoid the combinatorial explosion that typical
subgraph counting algorithms face. We prove that it suffices to enumerate only
four specific subgraphs (three of them have less than 5 vertices) to exactly
count all 5-vertex patterns.
  We perform extensive empirical experiments on a variety of real-world graphs.
We are able to compute counts of graphs with tens of millions of edges in
minutes on a commodity machine. To the best of our knowledge, this is the first
practical algorithm for $5$-vertex pattern counting that runs at this scale. A
stepping stone to our main algorithm is a fast method for counting all
$4$-vertex patterns. This algorithm is typically ten times faster than the
state of the art $4$-vertex counters.
