# What should be the way to design code for such a situation?

I have a graph as given below:

Let us assume one node as transmitter and another as receiver.

1. We need to transfer particles in every time slot constrained by maximum particles N and minimum 0. The combination of which particle in which time slot makes a code. I mean if 2 1 0 0 is a code that means that 2 particles in slot zero 1 in slot 1 and 0 particles in slot 2 and 3
2. Now let us suppose that any particle in a time slot can take any path and suffer through at most K delays. Delays are given by number of dots. More dots more delay. The delay to particles can be assigned randomly. The maximum delay for this graph is 4 it can be generalized to K. How to design codes so that information is reliably transferred across transmitter and receiver.

I just want to know how these codes are constructed, assuming that other codes must exists to be revealed. Also please tell me the prerequisites I need for such problem as I am not a computer engineer. One way is given in here

• You can't guarantee timely arrival over a fallible network. Allowing that we're either allowed to drop packets/particles or wait for them, don't we just number the packets? Commented Jun 8, 2017 at 8:50
• I can't tell what you're asking. What do you mean by "codes"? You say that the network introduces delays but what does that have to do with reliability? Reliability is about the network losing packets. You say that the delay is given by the number of dots but also that it's random. Which is it? Commented Jun 8, 2017 at 8:58
• @David Richerby by reliable transfer of information I mean that if code 2 1 0 0 is sent than the receiver should guess only 2 1 0 0 and not 2 0 1 0, if It introduces 1 unit delay in second slot, which means 2 0 1 0 is not a code if 2 1 0 0 is. Further the delay lets us say be decided by uniform or any other distribution. Commented Jun 8, 2017 at 9:44
• @Thumbnail We can wait for packets, so we are compromising on timely arrival, as in the reference I mentioned they have zero padded the system, allowing delayed packets to be accommodated. That is why delay has a limit as infinite delay will lead to zero capacity. Numbering the packets doesn't make sense as they are identical, so in 2 1 0 0 , for first reception,if two particles reach destination that is fine. It doesn't matter from which slot they have arrived Commented Jun 8, 2017 at 9:45

Off the top of my head...

Given a Packet, encode both the slot and count into the number with known limits.... a code can be computed ... and both the Sender and Receiver know what the limits are.

For example: 5 slots, and 7 possible counts (max count from 0..6 is 7 )

A CODE to determine what slot and count in that slot when it arrives

Code = Count_in_slot + (slot_number * (Max_Counts ) )

   Table of example CODES that could be sent or received

Slot            n counts
0   1   2   3   4   5   6
--- --- --- --- --- --- ---
0     0   1   2   3   4   5   6
1     7   8   9  10  11  12  13
2    14  15  16  17  18  19  20
3    21  22  23  24  25  25  27
4    28  29  30  31  32  33  34


Decode a Slot and count from the number :

 Sequence Initialize all ZERO's

temp  = Code
Count = temp mod max_count  (NOTE: Remainder of a division (Modular math )
temp  = temp \ max_count    (NOTE: integer divide)
Slot  = temp mod Number_of_slots
Sequence(Slot) = Count


And when either all slots are received, or max time wait occurs the reconstructed sequence is completed.

ALSO NOTE: If time delay is used to close the sequence, then slots with ZERO do not need to be sent.

• Thanks a lot!!! I think I quite get it, but need to work on it . One request how to get converse in such codes and their design, is it just intelligence or some sort of mathematics helps to grasp such things faster? Commented Jun 14, 2017 at 18:36
• Took me a bit to figure what the request was. Sorry I don't have the Academic Mathematics formulas. I was just solving the problem. Exposure to algorithms and structures helps. this problem was related to mixed Radix encoding also found this that might help cs.stackexchange.com/questions/57148/… Commented Jun 14, 2017 at 22:50
• ALSO ... some comments about about having a "packet" number is how the internet does it. OLD file transfers to allow for out-of-order coding before the internet on modems, there was [XMODEM] (en.wikipedia.org/wiki/XMODEM), which has a BLOCK number used to allow parts to show up out of order but still be reconstructed, and to request missing blocks. Commented Jun 14, 2017 at 22:52