title: One Gremlin query to get all connected vertices for multiple vertices
body: <p>may I get some help from improving our query?</p>
  <p>So the idea is that we have many connected sub-graphs, and each vertex has an unique id. Now we know some of ids, and we want to get all of the connected vertices in one query.</p>
  <p>For example, we have <strong>a -&gt; b &lt;- c -&gt; d</strong>, and <strong>e -&gt; f &lt;- g</strong>. Now the input is <strong>{b, e}</strong>, and the result we want is <strong>{a, b, c, d, e, f, g}</strong>. Because, {a, c, d} is connected to b and {f, g} is connected to e.</p>
  <p>Current I’m using a very dumb query like</p>
  <pre><code>g.V(&quot;b&quot;).emit().repeat(both().simplePath()).aggregate(&quot;connected&quot;)
   .V(&quot;e&quot;).emit().repeat(both().simplePath()).aggregate(&quot;connected&quot;)
   .select(&quot;connected&quot;).unfold().dedup()
  </code></pre>
  <p>which might work sometimes, but when (if) all the vertices are already connected to each other, I will run into MemoryLimitExceededException</p>