Applications of tensor networks in graphical models and quantum circuit simulations