[Networkit] allowing algorithms access to graph data structure internals

Florian Weber uagws at student.kit.edu
Tue Jul 15 20:53:53 CEST 2014


> *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 suspect that your problem is, that you don't include Graph.h in
ParallelPartitionCoarsening.h in a proper way (this might be because you
don't include it at all, because you include them cyclic, …).

To declare that a certain class Foo is your friend (and may touch your
privates, as the saying goes), you don't have to define Foo yet. The
following works perfectly fine:

class Bar {
	int i;
	friend class Foo; // forward-declare your friend

class Foo {
	void fun(Bar& x) const {x.i += 2;}

Concerning the solution of Moritz: That one has the problem, that it
leaves the class in a state with broken invariants, which isn't that
much better compared to friendship (such functionality should normally
be restricted -> private -> we are back at friendship).


-------------- n?chster Teil --------------
Ein Dateianhang mit Bin?rdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigr??e  : 884 bytes
Beschreibung: OpenPGP digital signature
URL         : <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140715/5a4ecd3c/attachment.sig>

More information about the NetworKit mailing list