title: How can Cypher Impose a Maximum Number of Hops Only Counting a Specific Type of Node?
body: <p>I know that in Neo4J, Cypher can be used to filter results based on a maximum number of hops between two nodes, like this:</p>
  
  <pre><code>MATCH (a:Word)-[relationships*..3]-(b:Word)
  RETURN a, relationships, b
  LIMIT 5
  </code></pre>
  
  <p>This will return nodes (a and b) that are both of type Word, and that are with 4 total hops of each other (through all node types, and all relationship types).</p>
  
  <p>I'm wondering whether Cypher can be made to <strong>only count specific types of nodes</strong> when it's counting to that maximum of 3 hops in the above example.</p>
  
  <p>For example, in this chain of nodes:</p>
  
  <p>(a:Word) ---> (b:Definition) ---> (c:Word) ---> (d:Definition) ---> (e:Definition) ---> (f:Word) ---> (g:Definition) ---> (h:Word)</p>
  
  <p>There are <strong>7 total hops</strong> between nodes <code>a</code> and <code>h</code>. However, there are only <strong>3 Word hops</strong> between them.</p>
  
  <p>Is it possible for Cypher to impose a maximum number of hops in this way?</p>