AddEdge will add a new edge between the provided vertices in the graph
(one, two int)
| 32 | |
| 33 | // AddEdge will add a new edge between the provided vertices in the graph |
| 34 | func (g *Graph) AddEdge(one, two int) { |
| 35 | // Add vertices: one and two to the graph if they are not present |
| 36 | g.AddVertex(one) |
| 37 | g.AddVertex(two) |
| 38 | |
| 39 | // and finally add the edges: one->two and two->one for undirected graph |
| 40 | g.edges[one][two] = struct{}{} |
| 41 | g.edges[two][one] = struct{}{} |
| 42 | } |
| 43 | |
| 44 | func (g *Graph) ValidateColorsOfVertex(colors map[int]Color) error { |
| 45 | if g.vertices != len(colors) { |