Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting symmetry in Market fromats #925

Open
maawad opened this issue Jun 30, 2022 · 3 comments
Open

Detecting symmetry in Market fromats #925

maawad opened this issue Jun 30, 2022 · 3 comments
Labels
🐲 enhancement Add or request enhancements to existing functionalities within gunrock.

Comments

@maawad
Copy link
Member

maawad commented Jun 30, 2022

Is your feature request related to a problem? Please describe.
Some Matrix Market files may be symmetric but the entire graph is stored in the file. Algorithms that require a symmetric input graph will not be able to detect that. Currently, we do this check in algorithms that require symmetric input (e.g., in TC):

io::matrix_market_t<vertex_t, edge_t, weight_t> mm;
auto mmatrix = mm.load(filename_);
if (!mm_is_symmetric(mm.code)) {
  std::cerr << "Error: input matrix must be symmetric" << std::endl;
  exit(1);
}

Describe the solution you'd like
Detect if the graph is symmetric after reading the general input Matrix Market file

@maawad maawad added the 🐲 enhancement Add or request enhancements to existing functionalities within gunrock. label Jun 30, 2022
@neoblizz
Copy link
Member

Detect if the graph is symmetric after reading the general input Matrix Market file

Do you mean not rely on the header of the MTX?

@maawad
Copy link
Member Author

maawad commented Jun 30, 2022

The header contains the keyword "general" instead of "symmetric". Here is an example:

%%MatrixMarket matrix coordinate pattern symmetric
% kind: undirected random graph
4194304 4194304 30359198

is the same graph as:

%%MatrixMarket matrix coordinate real general
4194304 4194304 60718396

@neoblizz
Copy link
Member

neoblizz commented Jul 4, 2022

Ok, I understand. Old gunrock got around this problem by allowing an option to "make undirected", which will first remove all the self-loops and then add a duplicate for every edge. It is not the same as "detecting" symmetry but will work the same way in practice. If I get some time, I'll consider adding this as a graph tool: https://github.com/gunrock/essentials/blob/master/include/gunrock/graph/graph.hxx#L405

@neoblizz neoblizz transferred this issue from gunrock/essentials Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐲 enhancement Add or request enhancements to existing functionalities within gunrock.
Projects
None yet
Development

No branches or pull requests

2 participants