- private fun conflicts_graph: Map[E, Set[E]] do
- if self.conflicts_graph_cache == null then
- self.conflicts_graph_cache = new HashMap[E, HashSet[E]]
- var core = reverse_linearize(self.core)
- for t in core do
- for i in self.linear_extension(t) do
- if t == i then continue
-
- var lin_i = self.linear_extension(i)
-
- for j in self.linear_extension(t) do
- if i == j or j == t then continue
- var lin_j = self.linear_extension(j)
-
- var d_ij = lin_i - lin_j
- var d_ji = lin_j - lin_i
-
- for ed1 in d_ij do
- if not conflicts_graph_cache.has_key(ed1) then conflicts_graph_cache[ed1] = new HashSet[E]
- # add ed1 x ed2 to conflicts graph
- for ed2 in d_ji do conflicts_graph_cache[ed1].add(ed2)
- end
- for ed1 in d_ij do
- if not conflicts_graph_cache.has_key(ed1) then conflicts_graph_cache[ed1] = new HashSet[E]
- # add ed1 x ed2 to conflicts graph
- for ed2 in d_ji do conflicts_graph_cache[ed1].add(ed2)
- end
+ private fun build_conflicts_graph do
+ self.conflicts_graph = new HashMap[E, HashSet[E]]
+ var core = reverse_linearize(self.core)
+ for t in core do
+ for i in self.linear_extension(t) do
+ if t == i then continue
+
+ var lin_i = self.linear_extension(i)
+
+ for j in self.linear_extension(t) do
+ if i == j or j == t then continue
+ var lin_j = self.linear_extension(j)
+
+ var d_ij = lin_i - lin_j
+ var d_ji = lin_j - lin_i
+
+ for ed1 in d_ij do
+ if not conflicts_graph.has_key(ed1) then conflicts_graph[ed1] = new HashSet[E]
+ # add ed1 x ed2 to conflicts graph
+ for ed2 in d_ji do conflicts_graph[ed1].add(ed2)
+ end
+ for ed1 in d_ij do
+ if not conflicts_graph.has_key(ed1) then conflicts_graph[ed1] = new HashSet[E]
+ # add ed1 x ed2 to conflicts graph
+ for ed2 in d_ji do conflicts_graph[ed1].add(ed2)