0

I am trying to compute the maximum antichain for a given poset. I have created the following method:

public boolean isIncomparable(Node a,Node b)
{
    if(isReachable(a,b)||isReachable(b,a))
         return false;
    return true;
}

which returns true if and only if the two nodes are incomparable (i.e.,there is no path from a to b nor from b to a ).

I defined a LinkedHashMap

LinkedHashMap<Node,ArrayList<Node>> map=new LinkedHashMap<Node,ArrayList<Node>>();

which maps every node N to its incomparable elements Incomp(N).

for(int i=0;i<nodes.size();i++)
{
   Node a=nodes.get(i);
   ArrayList<Node> tmp=new ArrayList<Node>();
   for(int j=i+1;j<nodes.size();j++)
   {
      Node b=nodes.get(j);
      if(isIncomparable(a,b))
           tmp.add(b)
   }
   map.put(a,tmp);
} 

For example: assume the elements are {A,B,C,D} with the following relation A>B, A>C, D>C then

Incomp(A)={D}
Incomp(B)={C,D}
Incomp(C)={}
Incomp(D)={}

Notice that duplicates are not allowed (i.e. Incomp(C)={B} but since (B,C) is in Incomp(B) we do not need to repeat it).

I am stuck here. Should I just check incomparability among Incomp(N) elements and then get the key with maximum size as the maximum antichain? In other words, how to find the maximum antichain with this setting?

I can't go with generating all subsets of size k as this going to be inefficient.

seteropere
  • 479
  • 1
  • 4
  • 17

0 Answers0