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

Method AddVertex

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

Source from the content-addressed store, hash-verified

70}
71
72func (g *graph) AddVertex(vertex VertexId) error {
73 i, _ := g.edges[vertex]
74 if i != nil {
75 return errors.New("Vertex already exists")
76 }
77
78 g.edges[vertex] = make(map[VertexId]int)
79
80 return nil
81}
82
83func (g *graph) RemoveVertex(vertex VertexId) error {
84 if !g.IsVertex(vertex) {

Callers 10

ReverseMethod · 0.80
TestUndirectedGraphFunction · 0.80
TestDirectedGraphFunction · 0.80
TestTopologicalSortFunction · 0.80
TestDijkstraFunction · 0.80
TestBfsShortestPathFunction · 0.80
TestBfsFunction · 0.80
TestTopologicalSortFunction · 0.80
TestUndirectedDfsFunction · 0.80
TestDirectedDfsFunction · 0.80

Calls

no outgoing calls

Tested by 9

TestUndirectedGraphFunction · 0.64
TestDirectedGraphFunction · 0.64
TestTopologicalSortFunction · 0.64
TestDijkstraFunction · 0.64
TestBfsShortestPathFunction · 0.64
TestBfsFunction · 0.64
TestTopologicalSortFunction · 0.64
TestUndirectedDfsFunction · 0.64
TestDirectedDfsFunction · 0.64