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

Method Reverse

data-structures/graph/directed_graph.go:55–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53}
54
55func (g *DirGraph) Reverse() *DirGraph {
56 r := NewDirected()
57
58 vertices := g.VerticesIter()
59 for vertex := range vertices {
60 r.AddVertex(vertex)
61 }
62
63 edges := g.EdgesIter()
64 for edge := range edges {
65 r.AddEdge(edge.To, edge.From, 1)
66 }
67
68 return r
69}

Callers 2

TestDirectedGraphFunction · 0.80
SccFunction · 0.80

Calls 5

NewDirectedFunction · 0.85
AddVertexMethod · 0.80
AddEdgeMethod · 0.80
VerticesIterMethod · 0.65
EdgesIterMethod · 0.65

Tested by 1

TestDirectedGraphFunction · 0.64