alanctprado / pace2024

MIT License
2 stars 0 forks source link

Crossing Matrix #25

Open heittpr opened 1 month ago

heittpr commented 1 month ago

Fixes #9.

This PR implements a modified version of Kobayashi and Tamaki's algorithm for computing crossing numbers for orientable pairs only. Tested against the tiny medium testsets. Example usage:

banana::crossing::CrossingMatrix c(graph);

auto p = c.getOrientablePairs();
std::cout << p.size() << " orientable pairs:" << std::endl;
for (auto[i, j] : p)
  std::cout << i+1 << ',' << j+1 << std::endl;

for (int i : graph.getB())
{
  for (int j : graph.getB())
    std::cout << std::setw(2) << c(i, j) << ' ';
  std::cout << std::endl;
}

Summary of changes:

luishgh commented 1 month ago

@heittpr I'll grab this PR and add the PI integration.