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

Method GetSuccessors

data-structures/graph/directed_graph.go:36–53  ·  view source on GitHub ↗
(vertex VertexId)

Source from the content-addressed store, hash-verified

34}
35
36func (g *graph) GetSuccessors(vertex VertexId) VerticesIterable {
37 iterator := func() <-chan VertexId {
38 ch := make(chan VertexId)
39 go func() {
40 if connected, ok := g.edges[vertex]; ok {
41 for VertexId, _ := range connected {
42 if g.IsEdge(vertex, VertexId) {
43 ch <- VertexId
44 }
45 }
46 }
47 close(ch)
48 }()
49 return ch
50 }
51
52 return VerticesIterable(&vertexIterableHelper{iterFunc: iterator})
53}
54
55func (g *DirGraph) Reverse() *DirGraph {
56 r := NewDirected()

Callers 3

TestDirectedGraphFunction · 0.80
SortFunction · 0.80
DirectedDfsFunction · 0.80

Calls 2

IsEdgeMethod · 0.95
VerticesIterableInterface · 0.85

Tested by 1

TestDirectedGraphFunction · 0.64