I want to implement a scala library for graphs. This library should also contain different types of trees.
1 the class tree extends the class graph
2 the class graph has a method getAllPrecursors(Node n) which returns all the Nodes fron which you can reach n.
3 the class tree has the method getParent(Node n) which returns the parent of the Node n (as an option, None marking the root)
Now, if someone calls the method "getAllPrecursors" for a tree I want to display a warning like " trees have at most 1 precursor, use getParent instead".
Is there any way to do this? Is there any better way of building this library? Should Trees not be a subclass of graph?