Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

bug in the pq-trees library ?

For the following PQ-tree named pqtree:

('P', [{3, 5, 7}, {4, 7}, {1, 7}, {3}, {6}, ('Q', [('P', [{0, 1, 3, 4}, {0, 6}]), {0, 2, 5}, ('P', [{2}, {2, 6}])])])

The command set_contiguous(4) gives:

sage: pqtree.set_contiguous(4) (1, True) sage: pqtree ('P', [{3, 5, 7}, {1, 7}, {3}, {6}, ('Q', [('P', [{2}, {2, 6}]), {0, 2, 5}, ('P', [{0, 6}, {0, 1, 3, 4}]), {4, 7}])])

Observe that the subset including 4 are not necessarily contiguous in this PQ-tree! Repeating the command gives:

sage: pqtree.set_contiguous(4) (1, True) sage: pqtree ('P', [{3, 5, 7}, {1, 7}, {3}, {6}, ('Q', [('P', [{2}, {2, 6}]), {0, 2, 5}, {0, 6}, {0, 1, 3, 4}, {4, 7}])])

Now it is OK, but we need to repeat twice the command.

bug in the pq-trees library ?

For the following PQ-tree named pqtree:

('P', [{3, 5, 7}, {4, 7}, {1, 7}, {3}, {6}, ('Q', [('P', [{0, 1, 3, 4}, {0, 6}]), {0, 2, 5}, ('P', [{2}, {2, 6}])])]) 

6}])])])

The command set_contiguous(4) gives:

sage: pqtree.set_contiguous(4)
(1, True)
sage: pqtree
('P', [{3, 5, 7}, {1, 7}, {3}, {6}, ('Q', [('P', [{2}, {2, 6}]), {0, 2, 5}, ('P', [{0, 6}, {0, 1, 3, 4}]), {4, 7}])]) 

7}])])

Observe that the subset including 4 are not necessarily contiguous in this PQ-tree! Repeating the command gives:

sage: pqtree.set_contiguous(4)
(1, True)
sage: pqtree
('P', [{3, 5, 7}, {1, 7}, {3}, {6}, ('Q', [('P', [{2}, {2, 6}]), {0, 2, 5}, {0, 6}, {0, 1, 3, 4}, {4, 7}])]) 

7}])])

Now it is OK, but we need to repeat twice the command.