#### Note

We encourage you to read the introductory :doc:`time-domain photonic circuits\n tutorial ` before jumping into this one!

\n\n\nTo achieve the goal of this tutorial we will propose a set of general rules\nto translate diagrams of experimental setups into time-domain Strawberry Fields\nprograms. We will apply these rules to two concrete experimental\nsetups and then, after gaining some intuition, will justify their validity\nand correctness.\n\n\nTime-domain rules\n-----------------\nNow we state the rules to translate a photonic circuit diagram into\na time-domain program:\n\n1. Identify the number of spatial modes ``M`` in your circuit. This number\n is equal to the number of wires appearing in the diagram.\n\n2. Obtain the number of concurrent modes in each spatial mode.\n This is the number of modes that are alive at any given time in each wire.\n For each spatial mode the number of concurrent modes is one more than the number of\n modes living in the delay lines in that wire (if there is any).\n The number of concurrent modes is specified as a list ``N`` where each entry is an integer\n greater than zero.\n\n3. Once you know the number of concurrent modes ``n = sum(N)``, one\n needs to assign them into the different parts of the\n circuit. We start with the first spatial mode placing the first qumode\n ``q[0]`` at the end of the wire, where the detector is, and then we update its location\n by tracing its path from right to left until we can place it on the right most time-bin. \n If there are more concurrent modes in the first spatial mode\n because of a delay line we assign modes ``q[1]`` to ``q[delay1]`` until \n every concurrent mode is accounted for in the first spatial mode. The indices of the \n modes must always increase from right to left.\n\n4. We now repeat step 3 for all the spatial modes. Assume we used ``delay1`` modes\n for the first spatial mode. Then we place qumode ``q[delay1+1]`` at the end \n of the second wire, slide back until the first concurrent mode we meet and \n then start to assign more qumodes until all the concurrent modes of the second\n spatial mode (wire) are accounted for. This we continue until all spatial modes \n have been assigned.\n\n5. Once the qumodes are assigned in a diagram read off which ones\n enter into the different gates. This step is more easily visualized\n once the previous steps are completed in a concrete example as we do\n below.\n\n\nOne dimensional cluster state\n-----------------------------\nAs a first example we consider the experiment from Yoshikawa et al.\nas described in `Figure 1