[Lemon-user] Inheriting from Lemon classes

Marco Blanco blanco at zib.de
Wed May 25 15:30:27 CEST 2016


Hello,

I am implementing a shortest path algorithm where the arc costs are 
unknown a priori and need to be computed on the fly. For that reason, I 
decided to try to define a class MyDijkstra, which inherits from 
lemon::Dijkstra<ListDigraph>. My plan was to override the member 
function processNextNode(), but then I realized that the Dijkstra class 
has some private members that I would need and don't have access to, 
such as the underlying digraph object. I temporarily solved the issue by 
replacing all "private" labels with "protected" in "dijkstra.h", but I 
don't like messing with the Lemon source code.

Is inheriting from Lemon classes discouraged in general? Can you think 
of an alternative way in which I could make use of the existing 
structure without having to copy-paste the entire class definition only 
to change two lines?

Thank you,
Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20160525/93d9f4ef/attachment.html>


More information about the Lemon-user mailing list