Class: Array

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#bkObject

Backtrackcycle



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'ext/bk/bk.c', line 98

static VALUE bk(VALUE arr) {
  int i, n;
  VALUE all, cliques, potential_clique;
  
  n = RARRAY_LEN(arr);

  all = rb_ary_new2(n);
  potential_clique = rb_ary_new();
  cliques = rb_ary_new();
  
  for (i = 0; i < n; i++) {
    rb_ary_push(all, INT2NUM(i));
  }

  bkv2(arr, all, 0, n, cliques, potential_clique);

  return cliques;
}