0

Problem : Given a labeled(1..n) undirected graph, create a model in Gecode for finding a supergraph with a given sequence degree:

Difficulties: the main difficulty is to find fancy model to accurately express degrees over it:

Why not Adjacency matrix? Because graph tends to be big and sparse

Why not Edge list? We are going to add edges, but we don't know how many of them, CP requires predefined number of variables (am I right?)

Why not Adjacency list? modeling problem as a list of sets we need to push a constraint for all i, j: (j in a[i] <=> i in a[j])

Solon
  • 362
  • 1
  • 13

1 Answers1

2

In the possibilities you offer using the "Adjacency list" will probably be the best one.

Your concern is that you will have to many propagators to channel between the sets; however Gecode includes a special channeling propagator to channel between sets: http://www.gecode.org/doc-latest/reference/classGecode_1_1Set_1_1Channel_1_1ChannelSet.html. This propagator channels exactly in the way you described and should minimize the effort spend on keeping the sets consistent.

Dekker1
  • 5,565
  • 25
  • 33