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)
|
visited = make(map[string]bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if already visited
|
|
||||||
if visited[n.Id()] == true {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// create new list of nodes
|
// create new list of nodes
|
||||||
var nodes []network.Node
|
var nodes []network.Node
|
||||||
|
|
||||||
// append the current node
|
// check if already visited
|
||||||
nodes = append(nodes, n)
|
if visited[n.Id()] == false {
|
||||||
|
// append the current node
|
||||||
|
nodes = append(nodes, n)
|
||||||
|
}
|
||||||
|
|
||||||
// set to visited
|
// set to visited
|
||||||
visited[n.Id()] = true
|
visited[n.Id()] = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user