code: private int getDegreeSafe(Node node, RelationshipType relType, Direction direction) {
          if (relType == null) {
              return node.getDegree(direction);
          }
  
          return node.getDegree(relType, direction);
      }
docs: works in cases when relType is null