Documentation
¶
Index ¶
- Variables
- type Connections
- type Graph
- func (g *Graph[K, V]) AddEdge(from K, to K, weight uint64, edge V) error
- func (g *Graph[K, V]) CalculateAllPairShortestPath()
- func (g *Graph[K, V]) GetConnectedVertices(vertex K) Connections[K, uint64, V]
- func (g *Graph[K, V]) GetEdgeCount() int
- func (g *Graph[K, V]) GetShortestRoute(from K, to K) Route[K, V]
- func (g *Graph[K, V]) GetVertexCount() int
- func (g *Graph[K, V]) ReadFromDisk(fileLocation string) error
- func (g *Graph[K, V]) SaveToDisk(fileLocation string) error
- type Route
- type Tuple2
- type WeightedEdge
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrEdgeExists = errors.New("edge exists between given vertices")
)
View Source
var (
ErrIncompatibleRoutes = errors.New("routes incompatible for concatenation")
)
Functions ¶
This section is empty.
Types ¶
type Connections ¶
type Connections[K comparable, W comparable, V any] map[K]WeightedEdge[W, V]
func (*Connections[K, W, V]) Added ¶
func (s *Connections[K, W, V]) Added(item K, weight W, edge V) *Connections[K, W, V]
func (*Connections[K, W, V]) Exists ¶
func (s *Connections[K, W, V]) Exists(item K) bool
type Graph ¶
type Graph[K comparable, V any] struct { IsBidirectional bool `json:"IsBidrectional"` Vertices map[K]Connections[K, uint64, V] `json:"Vertices"` VertexCount int `json:"VertexCount"` EdgeCount int `json:"EdgeCount"` AllPairShortestPaths map[Tuple2[K]]Route[K, V] `json:"AllPairShortestPath"` }
func (*Graph[K, V]) CalculateAllPairShortestPath ¶
func (g *Graph[K, V]) CalculateAllPairShortestPath()
func (*Graph[K, V]) GetConnectedVertices ¶
func (g *Graph[K, V]) GetConnectedVertices(vertex K) Connections[K, uint64, V]
func (*Graph[K, V]) GetEdgeCount ¶
func (*Graph[K, V]) GetShortestRoute ¶
func (*Graph[K, V]) GetVertexCount ¶
func (*Graph[K, V]) ReadFromDisk ¶
func (*Graph[K, V]) SaveToDisk ¶
type Route ¶
type Route[K comparable, V any] struct { Vertices []K Edges []WeightedEdge[uint64, V] Distance uint64 }
func (*Route[K, V]) AppendRoute ¶
type Tuple2 ¶
type Tuple2[K comparable] struct { One K Two K }
type WeightedEdge ¶
type WeightedEdge[W comparable, V any] struct { Weight W Metadata V }
Click to show internal directories.
Click to hide internal directories.