Hi,
I am currently trying to figure out a way to find just nodes that don't have any inner connections, but only outer.
I was going over documentation and trying to figure if there is something like that, but if I am not wrong, I would need to get list of all nodes from graph and check if there are some inner connections?
val g = Graph(1->2, 1->3, 4->5)
val containmentNodes = mutable.Set[Int]()
g.nodes.foreach(n => {
if (!g.get(n).hasPredecessors) {
println(n)
containmentNodes.add(n.value._1)
}
})
println(containmentNodes.mkString(", "))
Is there any more efficient way to do that?
Thanks