Documentation ¶
Index ¶
- type Graph
- type GraphCache
- func (c *GraphCache[S, T]) AddEdge(tail, head S, w float64)
- func (c *GraphCache[S, T]) AddEdgeWithTTL(tail, head S, w float64, ttl time.Duration)
- func (c *GraphCache[S, T]) AddVertex(key S, value T)
- func (c *GraphCache[S, T]) AddVertexWithTTL(key S, value T, ttl time.Duration)
- func (c *GraphCache[S, T]) GetVertex(key S) (T, bool)
- func (c *GraphCache[S, T]) Neighbor(seed S, step int) *Graph[S, T]
- func (c *GraphCache[S, T]) NeighborTFiDF(seed S, step int, top int) *Graph[S, T]
- func (c *GraphCache[S, T]) NeighborTFiDFLog(seed S, step int, top int) *Graph[S, T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph[S comparable, T any] struct { Vertices map[S]T `json:"vertices,omitempty"` Edges map[S]map[S]float64 `json:"edges,omitempty"` }
func NewGraph ¶
func NewGraph[S comparable, T any]() *Graph[S, T]
type GraphCache ¶
type GraphCache[S comparable, T any] struct { // contains filtered or unexported fields }
func NewGraphCache ¶
func NewGraphCache[S comparable, T any](ctx context.Context, defaultTTL time.Duration) *GraphCache[S, T]
func (*GraphCache[S, T]) AddEdge ¶
func (c *GraphCache[S, T]) AddEdge(tail, head S, w float64)
func (*GraphCache[S, T]) AddEdgeWithTTL ¶
func (c *GraphCache[S, T]) AddEdgeWithTTL(tail, head S, w float64, ttl time.Duration)
func (*GraphCache[S, T]) AddVertex ¶
func (c *GraphCache[S, T]) AddVertex(key S, value T)
func (*GraphCache[S, T]) AddVertexWithTTL ¶
func (c *GraphCache[S, T]) AddVertexWithTTL(key S, value T, ttl time.Duration)
func (*GraphCache[S, T]) GetVertex ¶
func (c *GraphCache[S, T]) GetVertex(key S) (T, bool)
func (*GraphCache[S, T]) Neighbor ¶
func (c *GraphCache[S, T]) Neighbor(seed S, step int) *Graph[S, T]
func (*GraphCache[S, T]) NeighborTFiDF ¶
func (c *GraphCache[S, T]) NeighborTFiDF(seed S, step int, top int) *Graph[S, T]
func (*GraphCache[S, T]) NeighborTFiDFLog ¶
func (c *GraphCache[S, T]) NeighborTFiDFLog(seed S, step int, top int) *Graph[S, T]
Click to show internal directories.
Click to hide internal directories.