misc: Fix typos and spelling errors

This commit is contained in:
Edward Toroshchyn
2025-02-24 15:59:00 +01:00
parent 1f90de31e7
commit c25a2a257b
40 changed files with 62 additions and 62 deletions

View File

@@ -240,7 +240,7 @@ func (g *Graph) DeleteVertex(xv ...Vertex) {
// AddEdge adds a directed edge to the graph from v1 to v2.
func (g *Graph) AddEdge(v1, v2 Vertex, e Edge) {
// NOTE: this doesn't allow more than one edge between two vertexes...
// NOTE: this doesn't allow more than one edge between two vertices...
g.AddVertex(v1, v2) // supports adding N vertices now
// TODO: check if an edge exists to avoid overwriting it!
// NOTE: VertexMerge() depends on overwriting it at the moment...
@@ -856,7 +856,7 @@ Loop:
// check edges
for v1 := range g.Adjacency() { // for each vertex in g
v2 := m[v1] // lookup in map to get correspondance
v2 := m[v1] // lookup in map to get correspondence
// g.Adjacency()[v1] corresponds to graph.Adjacency()[v2]
if e1, e2 := len(g.Adjacency()[v1]), len(graph.Adjacency()[v2]); e1 != e2 {
return fmt.Errorf("base graph, vertex(%s) has %d edges, while input graph, vertex(%s) has %d", v1, e1, v2, e2)

View File

@@ -54,7 +54,7 @@ func TestAddEdgeGraph1(t *testing.T) {
g.AddGraph(sub)
// expected (can re-use the same vertices)
// expected (can reuse the same vertices)
expected := &Graph{}
expected.AddEdge(v1, v3, e1)
expected.AddEdge(v2, v3, e2)
@@ -87,7 +87,7 @@ func TestAddEdgeVertexGraph1(t *testing.T) {
g.AddEdgeVertexGraph(v3, sub, edgeGenFn)
// expected (can re-use the same vertices)
// expected (can reuse the same vertices)
expected := &Graph{}
expected.AddEdge(v1, v3, e1)
expected.AddEdge(v2, v3, e2)
@@ -120,7 +120,7 @@ func TestAddEdgeGraphVertex1(t *testing.T) {
g.AddEdgeGraphVertex(sub, v3, edgeGenFn)
// expected (can re-use the same vertices)
// expected (can reuse the same vertices)
expected := &Graph{}
expected.AddEdge(v1, v3, e1)
expected.AddEdge(v2, v3, e2)
@@ -153,7 +153,7 @@ func TestAddEdgeVertexGraphLight1(t *testing.T) {
g.AddEdgeVertexGraphLight(v3, sub, edgeGenFn)
// expected (can re-use the same vertices)
// expected (can reuse the same vertices)
expected := &Graph{}
expected.AddEdge(v1, v3, e1)
expected.AddEdge(v2, v3, e2)
@@ -186,7 +186,7 @@ func TestAddEdgeGraphVertexLight1(t *testing.T) {
g.AddEdgeGraphVertexLight(sub, v3, edgeGenFn)
// expected (can re-use the same vertices)
// expected (can reuse the same vertices)
expected := &Graph{}
expected.AddEdge(v1, v3, e1)
expected.AddEdge(v2, v3, e2)