7

I want to construct a tree decomposition: http://en.wikipedia.org/wiki/Tree_decomposition and I have the chordal graph and a perfect elimination ordering. I am following advice given in a previous thread, namely:

To construct a non-nice (in general) tree decomposition of a chordal graph: find a perfect elimination ordering, enumerate the maximal cliques (the candidates are a vertex and the neighbors that appear after it in the ordering), use each clique as a decomposition node and connect it to the next clique in the ordering that it intersects.

This does not work however and I can not figure out why. Consider the following example:

Perfect elimination ordering:

['4', '3', '5', '7', '6', '2', '0', '1']

Chordal graph:

enter image description here

Tree decomposition:

enter image description here

I am using python and my current algorithm is the following:

T=nx.Graph()
    nodelist=[]
    for i in eo:
        vertex=str(i)
        bag=set()
        bag.add(vertex)
        for j in chordal_graph.neighbors(str(i)):
            bag.add(str(j))
        T.add_node(frozenset(bag))
        nodelist.append(frozenset(bag))
        chordal_graph.remove_node(str(i))
    for node1 in range(len(nodelist)):
        found=False
        for node2 in range(node1+1,len(nodelist)):
            if found==False and len(nodelist[node1].intersection(nodelist[node2]))>0:
                T.add_edge(nodelist[node1],nodelist[node2])
                found=True
    nx.draw(T)
    p.show()     

where eo is a list of the perfect ordering and 'chordal_graph' is a graph object for networkx.

Community
  • 1
  • 1
E.pojken
  • 365
  • 1
  • 2
  • 10

1 Answers1

2

So that was my (bad, as it turns out) advice. Your tree decomposition has some cliques that aren't maximal, i.e., {2, 0, 1}, {0, 1}, and {1}. The list of candidate cliques is

{4, 5, 6} (maximal)
{3, 2} (maximal)
{5, 6, 2, 0} (maximal)
{7, 2, 1} (maximal)
{6, 2, 0, 1} (maximal)
{2, 0, 1} (not maximal: subset of {6, 2, 0, 1})
{0, 1} (not maximal: subset of {6, 2, 0, 1})
{1} (not maximal: subset of {6, 2, 0, 1})

Then the decomposition should look like

                {3, 2}
                  |
{4, 5, 6}----{5, 6, 2, 0}
                  |
             {7, 2, 1}
                  |
             {6, 2, 0, 1},

which is wrong as well, since the 0 vertices aren't connected. Sorry about that.

What I should have done is to set aside the maximality condition for the moment and to connect each clique K to the next candidate seeded with a vertex belonging to K. This ensures that every vertex in K that exists in at least one other subsequent clique also appears in the target of the connection. Then the decomposition looks like this

{4, 5, 6}----{5, 6, 2, 0}
                  |
             {6, 2, 0, 1}
                  |
   {3, 2}----{2, 0, 1}----{7, 2, 1}
                  |
                {0, 1}
                  |
                {1}

and you can splice out the non-maximal cliques by checking, for each clique in reverse order, whether it's a superset of its parent, and if so, reparenting its parent's children to it.

{4, 5, 6}----{5, 6, 2, 0}
                  |
   {3, 2}----{6, 2, 0, 1}----{7, 2, 1}
David Eisenstat
  • 64,237
  • 7
  • 60
  • 120
  • Hi. Could you please explain this ``to connect each clique K to the next candidate seeded with a vertex belonging to K.''? What do you mean by the next candidate seeded with a vertex belong to K? If that means they have intersect, why does {4,5,6} not connected to {6,2,0,1}? Thanks. – Ali Shakiba Dec 01 '20 at 11:47
  • 1
    By "a clique seeded with a vertex v" I meant the clique comprised of v and the neighbors of v that appear after v in the perfect elimination ordering. We write down these cliques in the order given by the elimination ordering and then draw an edge from each clique to the next clique that it intersects. – David Eisenstat Dec 01 '20 at 14:02
  • 1
    Thanks for the reply. If I take this definition, so why {3, 2} is not connected to {5, 6, 2, 0} in the correct tree decomposition (the second tree decomposition)? – Ali Shakiba Dec 01 '20 at 14:48
  • 1
    @AliShakiba Ah, I can't help but keep screwing this up :(. Not the next clique that intersects, the clique generated by the seed's first neighbor that comes after the seed. – David Eisenstat Dec 01 '20 at 14:50
  • Thanks. I think this works. @DavidEisenstat – Ali Shakiba Dec 01 '20 at 14:52