title: Neo4j: Query to find the nodes with most relationships, and their connected nodes
body: <p>I am using Neo4j CE 3.1.1 and I have a relationship WRITES between authors and books. I want to find the N (say N=10 for example) books with the largest number of authors. Following some examples I found, I came up with the query:</p>
  
  <pre><code>MATCH (a)-[r:WRITES]-&gt;(b)
  RETURN r,
  COUNT(r) ORDER BY COUNT(r) DESC LIMIT 10
  </code></pre>
  
  <p>When I execute this query in the Neo4j browser I get 10 books, but these do not look like the ones written by most authors, as they show only a few WRITES relationships to authors. If I change the query to</p>
  
  <pre><code>MATCH (a)-[r:WRITES]-&gt;(b)
  RETURN b,
  COUNT(r) ORDER BY COUNT(r) DESC LIMIT 10
  </code></pre>
  
  <p>Then I get the 10 books with the most authors, but I don't see their relationship to authors. To do so, I have to write additional queries explicitly stating the name of a book I found in the previous query:</p>
  
  <pre><code>MATCH ()-[r:WRITES]-&gt;(b)
  WHERE b.title="Title of a book with many authors"
  RETURN r
  </code></pre>
  
  <p>What am I doing wrong? Why isn't the first query working as expected?</p>