updateEdges method

void updateEdges()

Implementation

void updateEdges() {
  Map<String,bool> edges = {};
  void add(int a, int b){
    final key = a < b ? '${a}_$b' : '${b}_$a';
    edges[key] = true;
  }
  for (int i = 0; i < indices.length / 3; i++) {
    int i3 = i * 3;
    final a = indices[i3];
    final b = indices[i3 + 1];
    final c = indices[i3 + 2];
    add(a, b);
    add(b, c);
    add(c, a);
  }

  this.edges = List.filled(edges.length * 2,0);
  int i = 0;
  for (String ind in edges.keys) {
    List<String> indices = ind.split('_');
    this.edges[2 * i] = int.parse(indices[0]);
    this.edges[2 * i + 1] = int.parse(indices[1]);
    i++;
  }
}