title: Drawing sorting networks
body: <p>What's a good way to draw sorting networks that look like those at the bottom of this post? A python package or LaTeX typsetting package would be much appreciated.</p>
  
  <p><a href="https://i.stack.imgur.com/IcV0u.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IcV0u.png" alt="Sorting network with groupings"></a>
  <a href="https://i.stack.imgur.com/e8VYE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e8VYE.png" alt="Simple sorting network"></a></p>