MCPcopy Index your code
hub / github.com/arnauddri/algorithms / GetPredecessors

Method GetPredecessors

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

Source from the content-addressed store, hash-verified

15}
16
17func (g *graph) GetPredecessors(vertex VertexId) VerticesIterable {
18 iterator := func() <-chan VertexId {
19 ch := make(chan VertexId)
20 go func() {
21 if connected, ok := g.edges[vertex]; ok {
22 for VertexId, _ := range connected {
23 if g.IsEdge(VertexId, vertex) {
24 ch <- VertexId
25 }
26 }
27 }
28 close(ch)
29 }()
30 return ch
31 }
32
33 return VerticesIterable(&vertexIterableHelper{iterFunc: iterator})
34}
35
36func (g *graph) GetSuccessors(vertex VertexId) VerticesIterable {
37 iterator := func() <-chan VertexId {

Callers 1

TestDirectedGraphFunction · 0.80

Calls 2

IsEdgeMethod · 0.95
VerticesIterableInterface · 0.85

Tested by 1

TestDirectedGraphFunction · 0.64