Similar Items: From Tensor Networks to Tractable Circuits, and back