[Networkit] allowing algorithms access to graph data structure internals

Christian Staudt christian.staudt at kit.edu
Tue Jul 15 16:46:58 CEST 2014

Hi NetworKit team,
I need some help with the following C++ question:

If the adjacencies of each node are to be written in parallel, we cannot do this using the normal addEdge method, because it writes data globally. I want to write an algorithm that constructs the core data structure in parallel and later ensures consistency of the Graph object. To let the algorithm access the internals of Graph, my first idea was to declare it as a friend class of Graph. However, the algorithm class itself includes and uses Graph, which I believe is the cause of the compiler errors I am getting.

	friend class ParallelPartitionCoarsening;

to Graph gives me:

src/cpp/graph/../coarsening/ParallelPartitionCoarsening.h:24:20: error: 'Graph' was not declared in this scope
  virtual std::pair<Graph, std::vector<node> > run(const Graph& G, const Partition& zeta);

I never used friend classes before - am I making a simple error here? How can I grant a class access to the private members of Graph?

Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140715/cfc6dd19/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140715/cfc6dd19/attachment.sig>

More information about the NetworKit mailing list