From A to B: An algorithmic approach to circulation inside buildings