<commit_before>#ifndef _GRAPH_H_
#define _GRAPH_H_

#include "MBRObject.h"
#include "RawStatistics.h"
#include "NodeArray.h"
#include "graph_color.h"

#include <vector>
#include <set>
#include <unordered_map>

#define FACE_LABEL_VISIBLE	1

#define NODE_SELECTED		1
#define NODE_LABEL_VISIBLE	2
#define NODE_FIXED_POSITION	4
#define NODE_IS_OPEN		8

class Graph;
class DisplayInfo;

struct node_tertiary_data_s {
  int first_edge = -1;
  float indegree = 0.0f, outdegree = 0.0f, coverage_weight = 0.0f;
  long long coverage = 0;
  int first_child = -1, next_child = -1, parent_node = -1;
  unsigned int child_count = 0;
  float age = 0.0;
  unsigned short flags = NODE_SELECTED;
  unsigned short label_visibility_val = 0;
  
  void setNodeFixedPosition(int i, bool t) {
    if (t) flags |= NODE_FIXED_POSITION;
    else flags &= ~NODE_FIXED_POSITION;
    // doesn't affect anything directly, so no need to update version
  }
  
  bool toggleNode(bool t) {
    if ((t && !isOpen()) || (!t && isOpen())) {
      if (t) flags |= NODE_IS_OPEN;
      else flags &= ~NODE_IS_OPEN;
      return true;
    } else {
      return false;
    }
  }

  bool isOpen() const { return flags & NODE_IS_OPEN; }  
  bool isFixed() const { return flags & NODE_FIXED_POSITION; }
  bool isSelected() const { return flags & NODE_SELECTED; }
  bool isLabelVisible() const { return flags & NODE_LABEL_VISIBLE; }

  bool setLabelVisibility(bool t) {
    if ((t && !isLabelVisible()) || (!t && isLabelVisible()) || 1) {
      if (t) flags |= NODE_LABEL_VISIBLE;
      else flags &= ~NODE_LABEL_VISIBLE;
      return true;
    } else {
      return false;
    }
  }

  float getLabelVisibilityValue() const { return label_visibility_val / 65535.0f; }

  void setLabelVisibilityValue(float f) {
    int f2 = int(f * 65535);
    if (f2 < 0) f2 = 0;
    else if (f2 > 65535) f2 = 65535;
    label_visibility_val = (unsigned short)f2;
  }
};

struct edge_data_s {
edge_data_s() : weight(1.0f), tail(-1), head(-1), next_node_edge(-1), face(-1), next_face_edge(-1), arc(0), coverage(0) { }
edge_data_s(float _weight, int _tail, int _head, int _next_node_edge, int _face, int _next_face_edge, int _arc, long long _coverage = 0)
: weight(_weight), tail(_tail), head(_head), next_node_edge(_next_node_edge), face(_face), next_face_edge(_next_face_edge), arc(_arc), coverage(_coverage) { }
  
  float weight;
  int tail, head, next_node_edge, face, next_face_edge, arc, pair_edge = -1, parent_edge = -1;
  long long coverage;
};

struct face_data_s {
  // glm::vec3 normal;
  glm::vec2 centroid;
  graph_color_s color;
  Rect2d mbr;
  int first_edge;
  time_t timestamp;
  float sentiment;
  short feed, lang;
  long long app_id, filter_id;
  std::string label;
  short label_texture, flags;
  unsigned short label_visibility_val;

  void setLabelVisibilityValue(float f) {
    int f2 = int(f * 65535);
    if (f2 < 0) f2 = 0;
    else if (f2 > 65535) f2 = 65535;
    label_visibility_val = (unsigned short)f2;
  }

  bool setLabelVisibility(bool t) {
    bool orig_t = flags | FACE_LABEL_VISIBLE ? true : false;
    if (t != orig_t || 1) {
      if (t) {
	flags |= FACE_LABEL_VISIBLE;
      } else {
	flags &= ~FACE_LABEL_VISIBLE;
      }
      return true;
    } else {
      return false;
    }
  }
  bool isLabelVisible() const { return flags & FACE_LABEL_VISIBLE; }
  float getLabelVisibilityValue() const { return label_visibility_val / 65535.0f; }
  void setLabel(const std::string & text) {
    if (label != text) {
      label = text;
      label_texture = 0;
    }
  }
  const std::string & getFaceLabel(int i) const { return label; }
};

#include "EdgeIterator.h"
#include "VisibleNodeIterator.h"

#include <string>
#include <vector>
#include <list><commit_msg>refactor and remove forced change<commit_after>#ifndef _GRAPH_H_
#define _GRAPH_H_

#include "MBRObject.h"
#include "RawStatistics.h"
#include "NodeArray.h"
#include "graph_color.h"

#include <vector>
#include <set>
#include <unordered_map>

#define FACE_LABEL_VISIBLE	1

#define NODE_SELECTED		1
#define NODE_LABEL_VISIBLE	2
#define NODE_FIXED_POSITION	4
#define NODE_IS_OPEN		8

class Graph;
class DisplayInfo;

struct node_tertiary_data_s {
  int first_edge = -1;
  float indegree = 0.0f, outdegree = 0.0f, coverage_weight = 0.0f;
  long long coverage = 0;
  int first_child = -1, next_child = -1, parent_node = -1;
  unsigned int child_count = 0;
  float age = 0.0;
  unsigned short flags = NODE_SELECTED;
  unsigned short label_visibility_val = 0;
  
  void setNodeFixedPosition(int i, bool t) {
    if (t) flags |= NODE_FIXED_POSITION;
    else flags &= ~NODE_FIXED_POSITION;
    // doesn't affect anything directly, so no need to update version
  }
  
  bool toggleNode(bool t) {
    if ((t && !isOpen()) || (!t && isOpen())) {
      if (t) flags |= NODE_IS_OPEN;
      else flags &= ~NODE_IS_OPEN;
      return true;
    } else {
      return false;
    }
  }

  bool isOpen() const { return flags & NODE_IS_OPEN; }  
  bool isFixed() const { return flags & NODE_FIXED_POSITION; }
  bool isSelected() const { return flags & NODE_SELECTED; }
  bool isLabelVisible() const { return flags & NODE_LABEL_VISIBLE; }

  bool setLabelVisibility(bool t) {
    if ((t && !isLabelVisible()) || (!t && isLabelVisible())) {
      if (t) flags |= NODE_LABEL_VISIBLE;
      else flags &= ~NODE_LABEL_VISIBLE;
      return true;
    } else {
      return false;
    }
  }

  float getLabelVisibilityValue() const { return label_visibility_val / 65535.0f; }

  void setLabelVisibilityValue(float f) {
    int f2 = int(f * 65535);
    if (f2 < 0) f2 = 0;
    else if (f2 > 65535) f2 = 65535;
    label_visibility_val = (unsigned short)f2;
  }
};

struct edge_data_s {
edge_data_s() : weight(1.0f), tail(-1), head(-1), next_node_edge(-1), face(-1), next_face_edge(-1), arc(0), coverage(0) { }
edge_data_s(float _weight, int _tail, int _head, int _next_node_edge, int _face, int _next_face_edge, int _arc, long long _coverage = 0)
: weight(_weight), tail(_tail), head(_head), next_node_edge(_next_node_edge), face(_face), next_face_edge(_next_face_edge), arc(_arc), coverage(_coverage) { }
  
  float weight;
  int tail, head, next_node_edge, face, next_face_edge, arc, pair_edge = -1, parent_edge = -1;
  long long coverage;
};

struct face_data_s {
  // glm::vec3 normal;
  glm::vec2 centroid;
  graph_color_s color;
  Rect2d mbr;
  int first_edge;
  time_t timestamp;
  float sentiment;
  short feed, lang;
  long long app_id, filter_id;
  std::string label;
  short label_texture, flags;
  unsigned short label_visibility_val;

  void setLabelVisibilityValue(float f) {
    int f2 = int(f * 65535);
    if (f2 < 0) f2 = 0;
    else if (f2 > 65535) f2 = 65535;
    label_visibility_val = (unsigned short)f2;
  }

  bool setLabelVisibility(bool t) {
    if ((t && !isLabelVisible()) || (!t && isLabelVisible())) {
      if (t) flags |= FACE_LABEL_VISIBLE;
      else flags &= ~FACE_LABEL_VISIBLE;
      return true;
    } else {
      return false;
    }
  }
  bool isLabelVisible() const { return flags & FACE_LABEL_VISIBLE; }
  float getLabelVisibilityValue() const { return label_visibility_val / 65535.0f; }
  void setLabel(const std::string & text) {
    if (label != text) {
      label = text;
      label_texture = 0;
    }
  }
  const std::string & getFaceLabel(int i) const { return label; }
};

#include "EdgeIterator.h"
#include "VisibleNodeIterator.h"

#include <string>
#include <vector>
#include <list>
{'fraction_non_alphanumeric': 0.11975806451612903, 'fraction_numerical': 0.025537634408602152, 'mean_word_length': 3.62461155997514, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '713921', 'n_tokens_mistral': 2815, 'n_tokens_neox': 2690, 'n_words': 715}