Skip to content

Provide functions for exporting matrices as sequential data types #454

Open
@sbaldu

Description

We currently define the adjacency matrix (and all other matrices) as hash maps, and this is the most optimal choice, but I was thinking that it would be useful to provide some functions for exporting those matrices as more standard sequential data structure (linearized vector, vector of vector, Eigen matrix, ecc.). This would be useful for example if a user wants to draw a heat map for those matrices. We could easily implement this with a template function specialized for each data type we want to support.
Furthermore, one might want to do some calculations with those matrices, and in that case a sequential data structure would be better because it would grant locality (this would be critical if the calculation is run on a GPU)

Example:

...
CXX::Graph<int> graph(edgeSet);
auto adj1 = export<std::vector<int>>(graph.getAdjMatrix());
auto adj2 = export<std::vector<std::vector<int>>>(graph.getAdjMatrix());
auto adj3 = export<Eigen::Matrix<int>>(graph.getAdjMatrix());
...

It could be a free function, a Graph method or both.

Wdyt @ZigRazor @nolankramer?

Metadata

Assignees

Labels

Priority:HighPriority Label for high priority issuePriority:MediumPriority Label for medium priority issuecoresomething about coreenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions