gusl: (Default)
[personal profile] gusl
Given a set L of permutations of a list, compute the maximal partial order (DAG) under which all lists in L are topological sorts. How would you do this? Can you do better than O(m n^2 k^2)? (m = number of lists in L, k = # of things in domain = the size of the elements of L)
Sounds like an ILP problem.

One idea: whenever a cycle is detected, all the elements are deemed incomparable.

(no subject)

Date: 2008-05-06 12:01 am (UTC)
From: [identity profile] bhudson.livejournal.com
Store the complete graph, then mark edges as inconsistent. Then DAGify it (um... not clear on that one, but that seems easy enough?). Marking edges is n work per item, and there are mn items. *Plus* k^2, instead of *times* k^2 like in your thing. Still not exactly palatable.

(no subject)

Date: 2008-05-06 12:07 am (UTC)
From: [identity profile] gustavolacerda.livejournal.com
<< Marking edges is n work per item, >>

What is an "item"?

(no subject)

Date: 2008-05-06 12:25 am (UTC)
From: [identity profile] gustavolacerda.livejournal.com
<< Marking edges is n work per item, and there are mn items.>>
and there are k(k-1) edges to loop through.

(no subject)

Date: 2008-05-06 02:39 am (UTC)
From: [identity profile] bhudson.livejournal.com
An item is a thing, of which you have k in the universe, but only n in any given list.

You don't need to loop through the entire set of edges just to mark one, hence you have an additive rather than multiplicative dependence on k2. O(mn2) to mark the edges, then another O(k2) to write out the edges that weren't marked.

Of course, what comes out isn't a DAG. We leave the final step as an exercise to the reader.

(no subject)

Date: 2008-05-06 03:44 am (UTC)
From: [identity profile] gustavolacerda.livejournal.com
<< You don't need to loop through the entire set of edges just to mark one >>

Sure. But you want to mark *all* edges, right?



<< Marking edges is n work per item, >>

are you marking *all edges* in O(nk)?

(no subject)

Date: 2008-05-06 03:53 pm (UTC)
From: [identity profile] bhudson.livejournal.com
There is confusion here. Maybe you should try to parrot my algorithm and we can figure out if we at least agree on that.

(no subject)

Date: 2008-05-06 12:17 am (UTC)
From: [identity profile] gustavolacerda.livejournal.com
One vague idea:

* take the UNION of all the complete DAGs corresponding to each list
* find all cycles there. A, B in the same cycle => A, B in the same "set" (permutations between things in the same set are graph automorphisms of the final DAG)
Edited Date: 2008-05-06 12:18 am (UTC)

(no subject)

Date: 2008-05-06 06:08 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
<< permutations between things in the same set are graph automorphisms of the final DAG >>

Therefore, all nodes in the same set have the same incoming and outgoing edges. This means we can collapse sets of nodes into "supernodes".
For the final DAG, you just make sure that there are no edges between members of the same set (and propagate each supernode's incoming and outgoing edges into all members... or you could just leave the final DAG in the supernode representation.

another idea

Date: 2008-05-06 12:21 am (UTC)
From: [identity profile] gustavolacerda.livejournal.com
sequence alignment

Re: another idea

Date: 2008-05-06 06:08 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
just like in diff.

(no subject)

Date: 2008-05-06 08:50 am (UTC)
From: [identity profile] rdore.livejournal.com
Your description is awful. I spent 10 minutes reading it and the comments over and over and I'm still not sure what the question is.

1. Use variables of some sort to denote things you're talk about
2. Don't call something a list unless its ordering is important

As far as I can tell you have:

A collection of k objects, let's call it X
A collection of linear orderings of subsets of X, which you call L

The size of L is m. Each linear ordering is on a subset of size n.

What you want to output is the maximum partial order of X which is a weaken of each element of L (on that element's domain).

If this is the right question, the answer is often not unique. For example, X={a,b,c} and L={[a,b],[a,c]}, then a maximal partial order will relate b and c in some way, but either way will do.
Edited Date: 2008-05-06 10:30 am (UTC)

(no subject)

Date: 2008-05-06 02:24 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
<< then a maximal partial order will relate b and c in some way, but either way will do. >>

This will not happen if all lists in L are permutations of each other (as stated). I guess I should have noticed that k=n.

(no subject)

Date: 2008-05-06 07:35 pm (UTC)
From: [identity profile] rdore.livejournal.com
Oh ok. Well suppressing log factors, I think the complexity is O(mk+k2). Make a graph on the k objects by throwing in all the consecutive pairs from all the lists. This is O(mk). Then detect all the strongly connected components - O(k2). Remove the edges of the strongly connected components - O(k2). Then take the transitive closure - I think this is O(k2) at least for a DAG, not sure.

(no subject)

Date: 2008-05-06 02:32 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
I think this post is a great example of how difficult mathematical communication is. The people exposing want to take shortcuts, while the people listening want to be completely clear on what everything means (but they don't share the language used in the shortcuts). It's very hard to put oneself in the other person's shoes.

(no subject)

Date: 2008-05-06 03:59 pm (UTC)
From: [identity profile] bhudson.livejournal.com
It seemed clear enough to me -- definitely well out of the realm of awful. I guess it is my bread and butter to work these things out.

(no subject)

Date: 2008-05-06 07:26 pm (UTC)
From: [identity profile] rdore.livejournal.com
It wasn't the technical terms that confused me, it was the less technical ones. Using "a list" to refer to two completely different things in the space of about eight words was the biggest problem. Also the fact that n and k were used to refer to the same quantity.

(no subject)

Date: 2008-05-06 07:57 pm (UTC)
From: [identity profile] bhudson.livejournal.com
For a good time, man perldsc.

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags