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

Method RemoveEdge

data-structures/graph/graph.go:137–154  ·  view source on GitHub ↗
(from, to VertexId)

Source from the content-addressed store, hash-verified

135}
136
137func (g *graph) RemoveEdge(from, to VertexId) error {
138 i, _ := g.edges[from][to]
139 j, _ := g.edges[to][from]
140
141 if i == -1 || j == -1 {
142 return errors.New("Edge doesn't exist")
143 }
144
145 g.edges[from][to] = -1
146
147 if !g.isDirected {
148 g.edges[to][from] = -1
149 }
150
151 g.edgesCount--
152
153 return nil
154}
155
156func (g *graph) IsEdge(from, to VertexId) bool {
157 connected, ok := g.edges[from]

Callers 1

TestUndirectedGraphFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestUndirectedGraphFunction · 0.64