unit
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- type Edge
- type Graph
- func (g *Graph[EdgeType, VertexType]) AddEdge(from, to VertexType, edge EdgeType) error
- func (g *Graph[EdgeType, VertexType]) GetForwardAdjacentVertices(from VertexType) []Edge[EdgeType, VertexType]
- func (g *Graph[EdgeType, VertexType]) GetReverseAdjacentVertices(to VertexType) []Edge[EdgeType, VertexType]
- func (g *Graph[EdgeType, VertexType]) ToDOT(name string) (string, error)
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeEdge¶
type Edge[EdgeType, VertexTypecomparable] struct {From VertexTypeTo VertexTypeEdge EdgeType}
Edge is a convenience type for representing an edge in the graph.It encapsulates the from and to vertices and the edge type itself.
typeGraph¶
type Graph[EdgeType, VertexTypecomparable] struct {// contains filtered or unexported fields}
Graph provides a bidirectional interface over gonum's directed graph implementation.While the underlying gonum graph is directed, we overlay bidirectional semanticsby distinguishing between forward and reverse edges. Wanting and being wanted byother units are related but different concepts that have different graph traversalimplications when Units update their status.
The graph stores edge types to represent different relationships between units,allowing for domain-specific semantics beyond simple connectivity.
func (*Graph[EdgeType, VertexType])AddEdge¶
AddEdge adds an edge to the graph. It initializes the graph and metadata on first use,checks for cycles, and adds the edge to the gonum graph.
func (*Graph[EdgeType, VertexType])GetForwardAdjacentVertices¶
func (g *Graph[EdgeType, VertexType]) GetForwardAdjacentVertices(from VertexType) []Edge[EdgeType, VertexType]
GetForwardAdjacentVertices returns all the edges that originate from the given vertex.
func (*Graph[EdgeType, VertexType])GetReverseAdjacentVertices¶
func (g *Graph[EdgeType, VertexType]) GetReverseAdjacentVertices(to VertexType) []Edge[EdgeType, VertexType]
GetReverseAdjacentVertices returns all the edges that terminate at the given vertex.