(from, to VertexId)
| 135 | } |
| 136 | |
| 137 | func (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 | |
| 156 | func (g *graph) IsEdge(from, to VertexId) bool { |
| 157 | connected, ok := g.edges[from] |
no outgoing calls