import poset
# Build a conflict graph from a POSet
-class POSetConflictGraph[E: Object]
+class POSetConflictGraph[E]
# Core is composed by:
# * elements that have mutiple direct parents
# REQUIRE: is_colored
var conflicts = new HashMap[E, Set[E]]
+ # The associated poset
var poset: POSet[E]
# The linearisation order to visit elements in the poset
#print "border: {border.join(" ")} ({border.length})"
#print "crown: {crown.join(" ")} ({crown.length})"
print "conflicts:"
- for e, c in conflicts do print " {e}: {c.join(" ")}"
+ for e, c in conflicts do print " {e or else "NULL"}: {c.join(" ")}"
end
end
+redef class POSet[E]
+ fun to_conflict_graph: POSetConflictGraph[E] do return new POSetConflictGraph[E](self)
+end
+
# Colorize elements from a POSet
# Two elements from a POSet cannot have the same color if they share common subelements
#