pq-tree
A PQ-tree is a data structure that represents all possible permutations of some elements limited by a set of constraints. Each constraint enforces consecutive ordering of a subset of elements in the leaf set of the tree.
PQ-tree based algorithms can be used for solving various problems, including consecutive ones property testing for matrices, graph planarity testing, interval graph recognition and so on.
A PQ-tree tree consists of three types of nodes: P-nodes, allowing arbitrary permutations of children, Q-nodes, allowing only reversions and L-nodes that represent tree leaves.
Demo
use PQTree;
// is this matrix C1P ?
let matrix = vec!;
let mut tree = from_leaves.unwrap;
tree = tree.reduction.unwrap;
tree = tree.reduction.unwrap;
tree = tree.reduction.unwrap;
tree = tree.reduction.unwrap;
tree = tree.reduction.unwrap;
tree.frontier.into_iter.for_each;
// [1, 1, 0, 1, 1]
// [1, 1, 1, 1, 1]
// [1, 1, 1, 1, 0]
// [1, 0, 1, 1, 0]
// [0, 0, 0, 1, 0]
// Yes, it is!