You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is often the need to build a graph of a network segment connected to a Node. This method does so. Stub idea:
privatefun <T> Environment<T, *>.connectedNodes(center:Node<T>): Set<Node<T>> {
funlocallyConnected(node:Node<T>) = getNeighborhood(node).neighbors.toSet()
val toVisit =ArrayDeque(locallyConnected(center))
val visited =mutableSetOf(center)
val result =mutableSetOf(center)
while (toVisit.isNotEmpty()) {
val subject = toVisit.removeFirst()
visited.add(subject)
toVisit.addAll(locallyConnected(subject) - visited)
result.add(subject)
}
return result
}
The text was updated successfully, but these errors were encountered:
There is often the need to build a graph of a network segment connected to a Node. This method does so. Stub idea:
The text was updated successfully, but these errors were encountered: