I am currently working on a problem which I assume mathematicians have already solved.
Setup: I have $N$ people standing in a line. Each of them is assigned with a different number between $1$ to $N$. All people in the line know their number and the number of each other in the line as well as the position of each other person relative to themselves.
Problem: I want to figure out the order of the people standing in the line but I only have some relative positions:
I can ask $M\leq N$ people to tell me their relative position to $r$ other people of their choice with an integer value between $-p$ to $p$ where $p$ indicates whether the other person is ahead of them in the line (positive value) or behind them (negative value), $0$ is their own position. E.g. for $p=1$ it would be a binary information behind/ahead. For $p=2$ one could differentiate between far ahead (+2) or close ahead (+1), or far behind (-2) and close behind (-1). Overall I get $M*r$ relative positions. To make things more interesting a portion $q<0.1$ of those $M*r$ is false information because the person lied.
Example: $N=5$, $M=5$, $r = 2$, $p = 1$, $q = 0.1$. The actual unknown line order is $[3,5,2,4,1]$.
I ask $M=5$ people to tell me $r=2$ relative positions.
- #1 tells me that #5 is behind him, and #2 is behind him
- #2 tells me that #4 is ahead of him, and #3 is behind him
- #3 tells me that #1 is ahead of him, and #2 is behind him (the 2nd info is a lie)
- #4 tells me that #1 is ahead of him, and #5 is behind him
- #5 tells me that #4 is ahead of him, and #3 is behind him
Which algorithm or mathematical field can I apply to find the most probable actual order? It must be efficient to work for N>100, so trying all possible combinations is not an option I guess. Obviously, this problem will not be solvable for all kind of possible outcomes, but I want to determine how much information I need to be about 90% accurate with my prediction. I do not need any analytical model just an idea how this could be solved by an iterative method which is programmable.
I hope you got the idea, otherwise let me know.
Thanks
Update with topological sorting applied (q=0) Mathematica Example Code