Visit all the nodes in flatten
This commit is contained in:
parent
1f5ebf330d
commit
b2f99a27b7
@ -27,16 +27,14 @@ func flatten(n network.Node, visited map[string]bool) []network.Node {
|
||||
visited = make(map[string]bool)
|
||||
}
|
||||
|
||||
// check if already visited
|
||||
if visited[n.Id()] == true {
|
||||
return nil
|
||||
}
|
||||
|
||||
// create new list of nodes
|
||||
var nodes []network.Node
|
||||
|
||||
// check if already visited
|
||||
if visited[n.Id()] == false {
|
||||
// append the current node
|
||||
nodes = append(nodes, n)
|
||||
}
|
||||
|
||||
// set to visited
|
||||
visited[n.Id()] = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user