I try to implement the following graph class in scala: case class NodeT
case class Node[T](i:T)
class Graph[N<:Node[T], +T](someNodes:Set[N], val edges:Set[(N,N)]) {
val nodes: Set[N] = someNodes ++ edges.map(_._1) ++ edges.map(_._2)
def addVortex(node:N)=new Graph(someNodes, edges)//just use someNodes instead of nodes + node
}
But there is an error saying
inferred type arguments [N,Nothing] do not conform to class Graph's type parameter bounds [N <: Node[T],+T]
Why does this happen?