MCPcopy
hub / github.com/arnauddri/algorithms / GetNeighbours

Method GetNeighbours

data-structures/graph/graph.go:179–194  ·  view source on GitHub ↗
(vertex VertexId)

Source from the content-addressed store, hash-verified

177}
178
179func (g *graph) GetNeighbours(vertex VertexId) VerticesIterable {
180 iterator := func() <-chan VertexId {
181 ch := make(chan VertexId)
182 go func() {
183 if connected, ok := g.edges[vertex]; ok {
184 for VertexId, _ := range connected {
185 ch <- VertexId
186 }
187 }
188 close(ch)
189 }()
190 return ch
191 }
192
193 return VerticesIterable(&vertexIterableHelper{iterFunc: iterator})
194}
195
196type vertexIterableHelper struct {
197 iterFunc func() <-chan VertexId

Callers 4

ShortestPathFunction · 0.80
ShortestPathFunction · 0.80
BfsFunction · 0.80
UndirectedDfsFunction · 0.80

Calls 1

VerticesIterableInterface · 0.85

Tested by

no test coverage detected