title: Neo4j: Data modelling and cypher, Paths independent of node combinations
body: <p>I am currently trying to solve a, what I thought simple, problem. I want model booster pack combinations from a TCG. Lets say a booster pack can contain 6 common, 3 uncommon and 1 rare rune. I want to know all combinations of rare, common and uncommon cards which are possible.</p>
  
  <p>In my first iteration I tried a hierarchical graph structure. The rare cards were connected to all uncommon ones, and the uncommon one to all commons. Now I start my query with  an rare card, go from there to three uncommon ones and then from an uncommon one to 6 common ones.</p>
  
  <p>In the second iteration I tried grouping the cards by rarity. All rare cards were connected to all other rare ones and so on.</p>
  
  <p>In both iterations I had the problem, that my queries didnt finish.
  For an expansion consisting of 57 cards, I got about 16000 combination of rares und uncommons alone. When I try to add the commons nodes to the path, cypher explodes. Part of the problem is, that I get "duplicates" like</p>
  
  <pre><code>Path1 = rare1-&gt;uncommon1, rare1-&gt;uncommon2, rare1-&gt;uncommon2
  Path2 = rare1-&gt;uncommon2, rare1-&gt;uncommon1, rare1-&gt;uncommon3
  Path3 = rare1-&gt;uncommon3, rare1-&gt;uncommon2, rare1-&gt;uncommon1
  Path4 = rare1-&gt;uncommon3, rare1-&gt;uncommon1, rare1-&gt;uncommon2
  </code></pre>
  
  <p>and so on
  Any ideas on how I can solve this?</p>