mirror of
https://github.com/aljazceru/crawler_v2.git
synced 2025-12-18 16:04:21 +01:00
removed unused function
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"github/pippellia-btc/crawler/pkg/graph"
|
||||
"github/pippellia-btc/crawler/pkg/walks"
|
||||
"math/rand/v2"
|
||||
"slices"
|
||||
)
|
||||
|
||||
var ErrEmptyWalkStore = errors.New("the walk store is empty")
|
||||
@@ -251,28 +250,6 @@ func frequencyMap(path []graph.ID) map[graph.ID]float64 {
|
||||
return freqs
|
||||
}
|
||||
|
||||
// targetFrequency returns the frequency of visits for each target
|
||||
func targetFrequency(targets []graph.ID, path []graph.ID) []float64 {
|
||||
if len(targets) == 0 || len(path) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
total := len(path)
|
||||
freq := 1.0 / float64(total)
|
||||
freqs := make([]float64, len(targets))
|
||||
|
||||
for _, node := range path {
|
||||
idx := slices.Index(targets, node)
|
||||
if idx == -1 {
|
||||
continue
|
||||
}
|
||||
|
||||
freqs[idx] += freq
|
||||
}
|
||||
|
||||
return freqs
|
||||
}
|
||||
|
||||
// returns a random element of a slice. It panics if the slice is empty or nil.
|
||||
func randomElement[S []E, E any](s S) E {
|
||||
return s[rand.IntN(len(s))]
|
||||
|
||||
Reference in New Issue
Block a user