Building a sequence that approximates given sequences
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Suppose that we are given three sequences $a1,a2$ and $a3$ each describing a total ordering on $N$ 'entities'. For example,
$$langle a1rangle=1<9<8<2<3<cdots<N $$
means that entity #1 is worst and entity #N is the best according to $a1$.
I need to come up with a new total ordering, let us call it $langle x rangle$ that best approximates all given orderings.
One way I was thinking of doing this task with $N=4$:
$$<a1> = 1<3<4<2 $$ $$<a2> = 1<2<4<3 $$
$$<a3> = 4<2<3<1 $$
Look at each pair $x,y in lbrace 1,2,3,4 rbrace, xneq y $. For example let us look at the tuple $(1,4)$. Clearly the first two sequences claim $1<4$ while the third claims $4<1$. Pick out the majority winner. Here, $1<4$ wins.
Do this for each possible tuple. We then have $binomN2$ such tuples.
List them , for eg: $1<4$, $2<3$, ...
Use these now to combine them into a total ordering $<x>$.
ISSUE: This problem can be converted to the Hamilton Path problem. Let each number be a vertex. Put a directed edge between $x$ and $y$ iff $x<y$. Now find the directed path that convers each vertex exactly once, this is my $<x>$.
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete). If so, in what other ways can I do this task?
combinatorics algorithms computer-science order-theory computer-arithmetic
add a comment |Â
up vote
1
down vote
favorite
Suppose that we are given three sequences $a1,a2$ and $a3$ each describing a total ordering on $N$ 'entities'. For example,
$$langle a1rangle=1<9<8<2<3<cdots<N $$
means that entity #1 is worst and entity #N is the best according to $a1$.
I need to come up with a new total ordering, let us call it $langle x rangle$ that best approximates all given orderings.
One way I was thinking of doing this task with $N=4$:
$$<a1> = 1<3<4<2 $$ $$<a2> = 1<2<4<3 $$
$$<a3> = 4<2<3<1 $$
Look at each pair $x,y in lbrace 1,2,3,4 rbrace, xneq y $. For example let us look at the tuple $(1,4)$. Clearly the first two sequences claim $1<4$ while the third claims $4<1$. Pick out the majority winner. Here, $1<4$ wins.
Do this for each possible tuple. We then have $binomN2$ such tuples.
List them , for eg: $1<4$, $2<3$, ...
Use these now to combine them into a total ordering $<x>$.
ISSUE: This problem can be converted to the Hamilton Path problem. Let each number be a vertex. Put a directed edge between $x$ and $y$ iff $x<y$. Now find the directed path that convers each vertex exactly once, this is my $<x>$.
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete). If so, in what other ways can I do this task?
combinatorics algorithms computer-science order-theory computer-arithmetic
What's your metric for how closely a new ordering approximates all the given orderings?
â Brian Tung
Jul 23 at 22:04
I don't have one specifically, essentially I want the relative orders to be as consistent as possible .hence the idea I mentioned
â Vinayak Suresh
Jul 24 at 0:32
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Suppose that we are given three sequences $a1,a2$ and $a3$ each describing a total ordering on $N$ 'entities'. For example,
$$langle a1rangle=1<9<8<2<3<cdots<N $$
means that entity #1 is worst and entity #N is the best according to $a1$.
I need to come up with a new total ordering, let us call it $langle x rangle$ that best approximates all given orderings.
One way I was thinking of doing this task with $N=4$:
$$<a1> = 1<3<4<2 $$ $$<a2> = 1<2<4<3 $$
$$<a3> = 4<2<3<1 $$
Look at each pair $x,y in lbrace 1,2,3,4 rbrace, xneq y $. For example let us look at the tuple $(1,4)$. Clearly the first two sequences claim $1<4$ while the third claims $4<1$. Pick out the majority winner. Here, $1<4$ wins.
Do this for each possible tuple. We then have $binomN2$ such tuples.
List them , for eg: $1<4$, $2<3$, ...
Use these now to combine them into a total ordering $<x>$.
ISSUE: This problem can be converted to the Hamilton Path problem. Let each number be a vertex. Put a directed edge between $x$ and $y$ iff $x<y$. Now find the directed path that convers each vertex exactly once, this is my $<x>$.
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete). If so, in what other ways can I do this task?
combinatorics algorithms computer-science order-theory computer-arithmetic
Suppose that we are given three sequences $a1,a2$ and $a3$ each describing a total ordering on $N$ 'entities'. For example,
$$langle a1rangle=1<9<8<2<3<cdots<N $$
means that entity #1 is worst and entity #N is the best according to $a1$.
I need to come up with a new total ordering, let us call it $langle x rangle$ that best approximates all given orderings.
One way I was thinking of doing this task with $N=4$:
$$<a1> = 1<3<4<2 $$ $$<a2> = 1<2<4<3 $$
$$<a3> = 4<2<3<1 $$
Look at each pair $x,y in lbrace 1,2,3,4 rbrace, xneq y $. For example let us look at the tuple $(1,4)$. Clearly the first two sequences claim $1<4$ while the third claims $4<1$. Pick out the majority winner. Here, $1<4$ wins.
Do this for each possible tuple. We then have $binomN2$ such tuples.
List them , for eg: $1<4$, $2<3$, ...
Use these now to combine them into a total ordering $<x>$.
ISSUE: This problem can be converted to the Hamilton Path problem. Let each number be a vertex. Put a directed edge between $x$ and $y$ iff $x<y$. Now find the directed path that convers each vertex exactly once, this is my $<x>$.
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete). If so, in what other ways can I do this task?
combinatorics algorithms computer-science order-theory computer-arithmetic
asked Jul 23 at 21:55
Vinayak Suresh
414
414
What's your metric for how closely a new ordering approximates all the given orderings?
â Brian Tung
Jul 23 at 22:04
I don't have one specifically, essentially I want the relative orders to be as consistent as possible .hence the idea I mentioned
â Vinayak Suresh
Jul 24 at 0:32
add a comment |Â
What's your metric for how closely a new ordering approximates all the given orderings?
â Brian Tung
Jul 23 at 22:04
I don't have one specifically, essentially I want the relative orders to be as consistent as possible .hence the idea I mentioned
â Vinayak Suresh
Jul 24 at 0:32
What's your metric for how closely a new ordering approximates all the given orderings?
â Brian Tung
Jul 23 at 22:04
What's your metric for how closely a new ordering approximates all the given orderings?
â Brian Tung
Jul 23 at 22:04
I don't have one specifically, essentially I want the relative orders to be as consistent as possible .hence the idea I mentioned
â Vinayak Suresh
Jul 24 at 0:32
I don't have one specifically, essentially I want the relative orders to be as consistent as possible .hence the idea I mentioned
â Vinayak Suresh
Jul 24 at 0:32
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete).
The argument is both incorrect and wrong.
It's incorrect because reduction arguments have to go the other way: by solving your problem you can solve any instance of a known NP-complete problem (and the reduction is polynomial).
It's wrong because the graph defined in your problem is a tournament (Wikipedia, MathWorld) and a Hamiltonian path in a tournament on $n$ vertices can be found in $O(n lg n)$ time. See e.g.
Bang-Jensen and Gutin, On the complexity of hamiltonian path and cycle problems in certain classes of digraphs, for a survey.
Although it's not directly what you ask, I should note a problem with the proposed algorithm:
Now find the directed path that convers each vertex exactly once, this is my $<x>$.
(my emphasis). There isn't necessarily a unique Hamiltonian path. Consider the minimal example where the three input orders are $$1 < 2 < 3 \ 2 < 3 < 1 \ 3 < 1 < 2$$
The graph is a cycle $1 to 2 to 3 to 1$, so there are three Hamiltonian paths. Obviously in this case the three are equally good / bad approximations, but maybe a more complicated example which embeds them would have Hamiltonian paths which vary in how many of the original pairwise comparisons they contradict.
Thank you for the answer. I see the problem you mentioned. Do you have any other ideas for a different or similar algorithm?
â Vinayak Suresh
Jul 25 at 14:03
@VinayakSuresh, you could weight the edges by the number of total orderings they contradict (so all the weights will be 0 or 1) and then treat it as an instance of the travelling salesman problem. That seems like a reasonable definition of the "best" total order(s), but I'm not sure whether it's known to be in P. You could try to adapt an algorithm for Hamiltonian path on tournaments to TSP on weighted tournaments; it might have enough structure for dynamic programming to be effective.
â Peter Taylor
Jul 25 at 14:39
I do not quite understand what you mean. So we have these three sequences and they each result in a tournament graph that is transitive and contains no cycles. However, when we take the majority vote and construct the new tournament graph, cycles can be introduced. So are you saying to completely do away with 'taking majority vote'. Which graph should I add these wieghts on?
â Vinayak Suresh
Jul 25 at 15:43
When you take the majority vote, it's either unanimous or it's 2 vs 1. If it's unanimous then give the edge weight 0; otherwise give it weight 1.
â Peter Taylor
Jul 25 at 15:51
aah, good idea! I was wondering if there was a way to find all possible hamiltonian paths in the graph efficiently? And then I could just add the weights on the paths to select the best one. I haven't been able to find an algorithm to find ALL hamiltonian paths.
â Vinayak Suresh
Jul 25 at 15:54
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete).
The argument is both incorrect and wrong.
It's incorrect because reduction arguments have to go the other way: by solving your problem you can solve any instance of a known NP-complete problem (and the reduction is polynomial).
It's wrong because the graph defined in your problem is a tournament (Wikipedia, MathWorld) and a Hamiltonian path in a tournament on $n$ vertices can be found in $O(n lg n)$ time. See e.g.
Bang-Jensen and Gutin, On the complexity of hamiltonian path and cycle problems in certain classes of digraphs, for a survey.
Although it's not directly what you ask, I should note a problem with the proposed algorithm:
Now find the directed path that convers each vertex exactly once, this is my $<x>$.
(my emphasis). There isn't necessarily a unique Hamiltonian path. Consider the minimal example where the three input orders are $$1 < 2 < 3 \ 2 < 3 < 1 \ 3 < 1 < 2$$
The graph is a cycle $1 to 2 to 3 to 1$, so there are three Hamiltonian paths. Obviously in this case the three are equally good / bad approximations, but maybe a more complicated example which embeds them would have Hamiltonian paths which vary in how many of the original pairwise comparisons they contradict.
Thank you for the answer. I see the problem you mentioned. Do you have any other ideas for a different or similar algorithm?
â Vinayak Suresh
Jul 25 at 14:03
@VinayakSuresh, you could weight the edges by the number of total orderings they contradict (so all the weights will be 0 or 1) and then treat it as an instance of the travelling salesman problem. That seems like a reasonable definition of the "best" total order(s), but I'm not sure whether it's known to be in P. You could try to adapt an algorithm for Hamiltonian path on tournaments to TSP on weighted tournaments; it might have enough structure for dynamic programming to be effective.
â Peter Taylor
Jul 25 at 14:39
I do not quite understand what you mean. So we have these three sequences and they each result in a tournament graph that is transitive and contains no cycles. However, when we take the majority vote and construct the new tournament graph, cycles can be introduced. So are you saying to completely do away with 'taking majority vote'. Which graph should I add these wieghts on?
â Vinayak Suresh
Jul 25 at 15:43
When you take the majority vote, it's either unanimous or it's 2 vs 1. If it's unanimous then give the edge weight 0; otherwise give it weight 1.
â Peter Taylor
Jul 25 at 15:51
aah, good idea! I was wondering if there was a way to find all possible hamiltonian paths in the graph efficiently? And then I could just add the weights on the paths to select the best one. I haven't been able to find an algorithm to find ALL hamiltonian paths.
â Vinayak Suresh
Jul 25 at 15:54
add a comment |Â
up vote
2
down vote
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete).
The argument is both incorrect and wrong.
It's incorrect because reduction arguments have to go the other way: by solving your problem you can solve any instance of a known NP-complete problem (and the reduction is polynomial).
It's wrong because the graph defined in your problem is a tournament (Wikipedia, MathWorld) and a Hamiltonian path in a tournament on $n$ vertices can be found in $O(n lg n)$ time. See e.g.
Bang-Jensen and Gutin, On the complexity of hamiltonian path and cycle problems in certain classes of digraphs, for a survey.
Although it's not directly what you ask, I should note a problem with the proposed algorithm:
Now find the directed path that convers each vertex exactly once, this is my $<x>$.
(my emphasis). There isn't necessarily a unique Hamiltonian path. Consider the minimal example where the three input orders are $$1 < 2 < 3 \ 2 < 3 < 1 \ 3 < 1 < 2$$
The graph is a cycle $1 to 2 to 3 to 1$, so there are three Hamiltonian paths. Obviously in this case the three are equally good / bad approximations, but maybe a more complicated example which embeds them would have Hamiltonian paths which vary in how many of the original pairwise comparisons they contradict.
Thank you for the answer. I see the problem you mentioned. Do you have any other ideas for a different or similar algorithm?
â Vinayak Suresh
Jul 25 at 14:03
@VinayakSuresh, you could weight the edges by the number of total orderings they contradict (so all the weights will be 0 or 1) and then treat it as an instance of the travelling salesman problem. That seems like a reasonable definition of the "best" total order(s), but I'm not sure whether it's known to be in P. You could try to adapt an algorithm for Hamiltonian path on tournaments to TSP on weighted tournaments; it might have enough structure for dynamic programming to be effective.
â Peter Taylor
Jul 25 at 14:39
I do not quite understand what you mean. So we have these three sequences and they each result in a tournament graph that is transitive and contains no cycles. However, when we take the majority vote and construct the new tournament graph, cycles can be introduced. So are you saying to completely do away with 'taking majority vote'. Which graph should I add these wieghts on?
â Vinayak Suresh
Jul 25 at 15:43
When you take the majority vote, it's either unanimous or it's 2 vs 1. If it's unanimous then give the edge weight 0; otherwise give it weight 1.
â Peter Taylor
Jul 25 at 15:51
aah, good idea! I was wondering if there was a way to find all possible hamiltonian paths in the graph efficiently? And then I could just add the weights on the paths to select the best one. I haven't been able to find an algorithm to find ALL hamiltonian paths.
â Vinayak Suresh
Jul 25 at 15:54
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete).
The argument is both incorrect and wrong.
It's incorrect because reduction arguments have to go the other way: by solving your problem you can solve any instance of a known NP-complete problem (and the reduction is polynomial).
It's wrong because the graph defined in your problem is a tournament (Wikipedia, MathWorld) and a Hamiltonian path in a tournament on $n$ vertices can be found in $O(n lg n)$ time. See e.g.
Bang-Jensen and Gutin, On the complexity of hamiltonian path and cycle problems in certain classes of digraphs, for a survey.
Although it's not directly what you ask, I should note a problem with the proposed algorithm:
Now find the directed path that convers each vertex exactly once, this is my $<x>$.
(my emphasis). There isn't necessarily a unique Hamiltonian path. Consider the minimal example where the three input orders are $$1 < 2 < 3 \ 2 < 3 < 1 \ 3 < 1 < 2$$
The graph is a cycle $1 to 2 to 3 to 1$, so there are three Hamiltonian paths. Obviously in this case the three are equally good / bad approximations, but maybe a more complicated example which embeds them would have Hamiltonian paths which vary in how many of the original pairwise comparisons they contradict.
Is my argument that this problem is NP complete correct? (Since Ham path is NP complete).
The argument is both incorrect and wrong.
It's incorrect because reduction arguments have to go the other way: by solving your problem you can solve any instance of a known NP-complete problem (and the reduction is polynomial).
It's wrong because the graph defined in your problem is a tournament (Wikipedia, MathWorld) and a Hamiltonian path in a tournament on $n$ vertices can be found in $O(n lg n)$ time. See e.g.
Bang-Jensen and Gutin, On the complexity of hamiltonian path and cycle problems in certain classes of digraphs, for a survey.
Although it's not directly what you ask, I should note a problem with the proposed algorithm:
Now find the directed path that convers each vertex exactly once, this is my $<x>$.
(my emphasis). There isn't necessarily a unique Hamiltonian path. Consider the minimal example where the three input orders are $$1 < 2 < 3 \ 2 < 3 < 1 \ 3 < 1 < 2$$
The graph is a cycle $1 to 2 to 3 to 1$, so there are three Hamiltonian paths. Obviously in this case the three are equally good / bad approximations, but maybe a more complicated example which embeds them would have Hamiltonian paths which vary in how many of the original pairwise comparisons they contradict.
edited Jul 24 at 10:21
answered Jul 24 at 10:14
Peter Taylor
7,73012239
7,73012239
Thank you for the answer. I see the problem you mentioned. Do you have any other ideas for a different or similar algorithm?
â Vinayak Suresh
Jul 25 at 14:03
@VinayakSuresh, you could weight the edges by the number of total orderings they contradict (so all the weights will be 0 or 1) and then treat it as an instance of the travelling salesman problem. That seems like a reasonable definition of the "best" total order(s), but I'm not sure whether it's known to be in P. You could try to adapt an algorithm for Hamiltonian path on tournaments to TSP on weighted tournaments; it might have enough structure for dynamic programming to be effective.
â Peter Taylor
Jul 25 at 14:39
I do not quite understand what you mean. So we have these three sequences and they each result in a tournament graph that is transitive and contains no cycles. However, when we take the majority vote and construct the new tournament graph, cycles can be introduced. So are you saying to completely do away with 'taking majority vote'. Which graph should I add these wieghts on?
â Vinayak Suresh
Jul 25 at 15:43
When you take the majority vote, it's either unanimous or it's 2 vs 1. If it's unanimous then give the edge weight 0; otherwise give it weight 1.
â Peter Taylor
Jul 25 at 15:51
aah, good idea! I was wondering if there was a way to find all possible hamiltonian paths in the graph efficiently? And then I could just add the weights on the paths to select the best one. I haven't been able to find an algorithm to find ALL hamiltonian paths.
â Vinayak Suresh
Jul 25 at 15:54
add a comment |Â
Thank you for the answer. I see the problem you mentioned. Do you have any other ideas for a different or similar algorithm?
â Vinayak Suresh
Jul 25 at 14:03
@VinayakSuresh, you could weight the edges by the number of total orderings they contradict (so all the weights will be 0 or 1) and then treat it as an instance of the travelling salesman problem. That seems like a reasonable definition of the "best" total order(s), but I'm not sure whether it's known to be in P. You could try to adapt an algorithm for Hamiltonian path on tournaments to TSP on weighted tournaments; it might have enough structure for dynamic programming to be effective.
â Peter Taylor
Jul 25 at 14:39
I do not quite understand what you mean. So we have these three sequences and they each result in a tournament graph that is transitive and contains no cycles. However, when we take the majority vote and construct the new tournament graph, cycles can be introduced. So are you saying to completely do away with 'taking majority vote'. Which graph should I add these wieghts on?
â Vinayak Suresh
Jul 25 at 15:43
When you take the majority vote, it's either unanimous or it's 2 vs 1. If it's unanimous then give the edge weight 0; otherwise give it weight 1.
â Peter Taylor
Jul 25 at 15:51
aah, good idea! I was wondering if there was a way to find all possible hamiltonian paths in the graph efficiently? And then I could just add the weights on the paths to select the best one. I haven't been able to find an algorithm to find ALL hamiltonian paths.
â Vinayak Suresh
Jul 25 at 15:54
Thank you for the answer. I see the problem you mentioned. Do you have any other ideas for a different or similar algorithm?
â Vinayak Suresh
Jul 25 at 14:03
Thank you for the answer. I see the problem you mentioned. Do you have any other ideas for a different or similar algorithm?
â Vinayak Suresh
Jul 25 at 14:03
@VinayakSuresh, you could weight the edges by the number of total orderings they contradict (so all the weights will be 0 or 1) and then treat it as an instance of the travelling salesman problem. That seems like a reasonable definition of the "best" total order(s), but I'm not sure whether it's known to be in P. You could try to adapt an algorithm for Hamiltonian path on tournaments to TSP on weighted tournaments; it might have enough structure for dynamic programming to be effective.
â Peter Taylor
Jul 25 at 14:39
@VinayakSuresh, you could weight the edges by the number of total orderings they contradict (so all the weights will be 0 or 1) and then treat it as an instance of the travelling salesman problem. That seems like a reasonable definition of the "best" total order(s), but I'm not sure whether it's known to be in P. You could try to adapt an algorithm for Hamiltonian path on tournaments to TSP on weighted tournaments; it might have enough structure for dynamic programming to be effective.
â Peter Taylor
Jul 25 at 14:39
I do not quite understand what you mean. So we have these three sequences and they each result in a tournament graph that is transitive and contains no cycles. However, when we take the majority vote and construct the new tournament graph, cycles can be introduced. So are you saying to completely do away with 'taking majority vote'. Which graph should I add these wieghts on?
â Vinayak Suresh
Jul 25 at 15:43
I do not quite understand what you mean. So we have these three sequences and they each result in a tournament graph that is transitive and contains no cycles. However, when we take the majority vote and construct the new tournament graph, cycles can be introduced. So are you saying to completely do away with 'taking majority vote'. Which graph should I add these wieghts on?
â Vinayak Suresh
Jul 25 at 15:43
When you take the majority vote, it's either unanimous or it's 2 vs 1. If it's unanimous then give the edge weight 0; otherwise give it weight 1.
â Peter Taylor
Jul 25 at 15:51
When you take the majority vote, it's either unanimous or it's 2 vs 1. If it's unanimous then give the edge weight 0; otherwise give it weight 1.
â Peter Taylor
Jul 25 at 15:51
aah, good idea! I was wondering if there was a way to find all possible hamiltonian paths in the graph efficiently? And then I could just add the weights on the paths to select the best one. I haven't been able to find an algorithm to find ALL hamiltonian paths.
â Vinayak Suresh
Jul 25 at 15:54
aah, good idea! I was wondering if there was a way to find all possible hamiltonian paths in the graph efficiently? And then I could just add the weights on the paths to select the best one. I haven't been able to find an algorithm to find ALL hamiltonian paths.
â Vinayak Suresh
Jul 25 at 15:54
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2860815%2fbuilding-a-sequence-that-approximates-given-sequences%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What's your metric for how closely a new ordering approximates all the given orderings?
â Brian Tung
Jul 23 at 22:04
I don't have one specifically, essentially I want the relative orders to be as consistent as possible .hence the idea I mentioned
â Vinayak Suresh
Jul 24 at 0:32