MCPcopy Create free account
hub / github.com/arnauddri/algorithms / EdgesIter

Method EdgesIter

data-structures/graph/graph.go:30–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28}
29
30func (g *graph) EdgesIter() <-chan Edge {
31 ch := make(chan Edge)
32 go func() {
33 for from, connectedVertices := range g.edges {
34 for to, _ := range connectedVertices {
35 if g.isDirected {
36 ch <- Edge{from, to}
37 } else {
38 if from < to {
39 ch <- Edge{from, to}
40 }
41 }
42 }
43 }
44 close(ch)
45 }()
46 return ch
47}
48
49func (g *graph) VerticesIter() <-chan VertexId {
50 ch := make(chan VertexId)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected