Skip to content

Commit

Permalink
Use nodeLevel instead of nodeColumn, fixed off-by-one error in median…
Browse files Browse the repository at this point in the history
…heuristic
  • Loading branch information
PJvGrol committed Jun 7, 2016
1 parent ef59620 commit db79a43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/UHC/Util/CHR/Solve/TreeTrie/Visualizer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ sortNodes n@(x:xs:xss) e = medianHeurstic x xs e ++ sortNodes (xs:xss) e
medianHeurstic :: [Node'] -> [Node'] -> [Edge'] -> [Node']
medianHeurstic l1 l2 e = map (\x -> nodeSetColumn x (median x)) l2
where
median n = coordinates n !! ceiling (realToFrac (length (coordinates n)) / 2)
median n = coordinates n !! (ceiling (realToFrac (length (coordinates n)) / 2) - 1)
coordinates n = map nodeColumn (neighbors n)
neighbors n = map (nodelist . fst') (edges n)
edges n = List.filter (\x -> snd' x == fst n) e
Expand Down

0 comments on commit db79a43

Please sign in to comment.