title: Gremlin query to get the count of edges and otherV of a node
body: <p>Use case:  Get all the edges of a node, grouped by the label and also group the otherV by the label, display name, and counts for both.</p>
  
  <p>Graph has the following nodes:  post, product, company.
  post has outE named review which goes to both product and company.</p>
  
  <p>For a postid, is there a way to get the count of reviews grouped by product and company.</p>
  
  <p>I would like to display in a table the following info.</p>
  
  <p>postid | review (count) | product (count)
  postid | review (count) | company (count)</p>
  
  <p>I tried <code>outE()</code>, <code>out()</code> with <code>groupby</code> label but I cannot seem to construct a query that will give me the counts with multiple <code>groupby</code>'s.</p>
  
  <p>Any help would be most appreciated.<br>
  Thanks in advance.</p>
  
  <pre><code>graph = TinkerGraph.open()
  g = graph.traversal()
  v1 = graph.addVertex(id, 1, label, "post")
  v2 = graph.addVertex(id, 2, label, "company")
  v3 = graph.addVertex(id, 3, label, "company")
  v4 = graph.addVertex(id, 4, label, "product")
  v5 = graph.addVertex(id, 5, label, "product")
  v1.addEdge("reviews", v2)
  v1.addEdge("reviews", v3)
  v1.addEdge("reviews", v4)
  v1.addEdge("reviews", v5)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/rb5TV.png" rel="nofollow noreferrer">Image</a></p>