I am using a high performance/parallel graph library written in C in a C++ project. It provides a struct stinger
(the graph data structure) and operations like
int stinger_insert_edge_pair (struct stinger *G,
int64_t type, int64_t from, int64_t to,
double weight, int64_t timestamp) { .... }
Most of the time, however, I do not want to specify timestamps or weights or types. Default parameters would be nice. Also, an OOP-like interface would be nice: G->insertEdge(u, v)
instead of insert_edge_pair(G, u, v, ...)
.
So I was thinking of creating an adapter class looking like
class Graph {
protected:
stinger* stingerG;
public:
/** default parameters ***/
double defaultEdgeWeight = 1.0;
/** methods **/
Graph(stinger* stingerG);
virtual void insertEdge(node u, node v, double weight=defaultEdgeWeight);
};
The method insertEdge(...)
simply calls stinger_insert_edge_pair(this->stingerG, ...)
with the appropriate parameters.
However, performance is a crucial aspect here. What is the performance penalty associated with using such an adapter class? Should I expect degraded performance compared to using the "naked" library?