Skip to content

Commit

Permalink
Use consistent generic parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
ammario committed Jun 14, 2024
1 parent e942b4f commit ff889c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func LoadSavedGraph[K cmp.Ordered](path string) (*SavedGraph[K], error) {
}

// Save writes the graph to the file.
func (g *SavedGraph[T]) Save() error {
func (g *SavedGraph[K]) Save() error {
tmp, err := renameio.TempFile("", g.Path)
if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func maxLevel(ml float64, numNodes int) int {
}

// randomLevel generates a random level for a new node.
func (h *Graph[T]) randomLevel() int {
func (h *Graph[K]) randomLevel() int {
// max avoids having to accept an additional parameter for the maximum level
// by calculating a probably good one from the size of the base layer.
max := 1
Expand All @@ -301,7 +301,7 @@ func (h *Graph[T]) randomLevel() int {
return max
}

func (g *Graph[T]) assertDims(n Vector) {
func (g *Graph[K]) assertDims(n Vector) {
if len(g.layers) == 0 {
return
}
Expand All @@ -313,7 +313,7 @@ func (g *Graph[T]) assertDims(n Vector) {

// Dims returns the number of dimensions in the graph, or
// 0 if the graph is empty.
func (g *Graph[T]) Dims() int {
func (g *Graph[K]) Dims() int {
if len(g.layers) == 0 {
return 0
}
Expand Down Expand Up @@ -447,7 +447,7 @@ func (h *Graph[K]) Search(near Vector, k int) []Node[K] {
}

// Len returns the number of nodes in the graph.
func (h *Graph[T]) Len() int {
func (h *Graph[K]) Len() int {
if len(h.layers) == 0 {
return 0
}
Expand Down

0 comments on commit ff889c9

Please sign in to comment.