Documentation ¶
Index ¶
- type Coords
- type Edge
- type Graph
- func (g *Graph) AddEdge(v1, v2 *Vertex) *Edge
- func (g *Graph) AddVertex(v *Vertex)
- func (g *Graph) GetEdgeBetweenVertices(v1, v2 *Vertex) *Edge
- func (g *Graph) GetEdgesCount() int
- func (g *Graph) GetEdgesForVertex(v *Vertex) []*Edge
- func (g *Graph) GetRandomVertex() *Vertex
- func (g *Graph) GetVerticesCount() int
- func (g *Graph) IsEmpty() bool
- type Vertex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coords ¶
Coords : Holds X/Y 2d coordinates
func (*Coords) DistanceTo ¶
DistanceTo : Calculates the distance between two coordinates
type Edge ¶
Edge : represents an edge on the graph
func (*Edge) GetOppositeEnd ¶
GetOppositeEnd : Return the opposite end vertex if both are connected returns nil otherwise
type Graph ¶
type Graph struct { Name string Vertices map[float64]*Vertex Edges map[float64]*Edge // contains filtered or unexported fields }
Graph : Represents an non oriented graph with vertices and edges
func (*Graph) GetEdgeBetweenVertices ¶
GetEdgeBetweenVertices : return the edge between the given vertices, or nil if it's not present
func (*Graph) GetEdgesCount ¶
GetEdgesCount : total number of edges in the graph
func (*Graph) GetEdgesForVertex ¶
GetEdgesForVertex : returns the edges connected to the vertex
func (*Graph) GetRandomVertex ¶
GetRandomVertex : return a random vertex from the vertices of the graph
func (*Graph) GetVerticesCount ¶
GetVerticesCount : total number of vertices in the graph