code: private boolean connected(NodeCursor start, long end, int[][] typedDirections) {
          try (RelationshipTraversalCursor relationship = ktx.cursors().allocateRelationshipTraversalCursor()) {
              start.allRelationships(relationship);
              while (relationship.next()) {
                  if (relationship.neighbourNodeReference() ==end) {
                      if (typedDirections==null) {
                          return true;
                      } else {
                          int direction = relationship.targetNodeReference() == end ? 0 : 1 ;
                          int[] types = typedDirections[direction];
                          if (arrayContains(types, relationship.type())) return true;
                      }
                  }
              }
          }
          return false;
      }
docs: TODO: be more efficient, in
  @param start
  @param end
  @param typedDirections
  @return