Documentation
¶
Index ¶
- type Edge
- type Graph
- func (g *Graph) AddEdge(x, y *Node) error
- func (g *Graph) AddNode(node *Node) error
- func (g *Graph) Adjancent(x *Node, y *Node) bool
- func (g *Graph) GetEdgeValue(x *Node, y *Node) int
- func (g *Graph) GetNodeValue(x *Node) string
- func (g *Graph) Neighbors(node *Node) ([]*Node, bool)
- func (g *Graph) RemoveEdge(x, y *Node) error
- func (g *Graph) RemoveNode(node *Node) bool
- func (g *Graph) SetEdgeValue(x, y *Node, value int) bool
- func (g *Graph) SetNodeValue(x *Node, value string)
- func (g *Graph) String()
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
Edge represents a link between two nodes (vertices) the Cost field is the weight between nodes, distance etc the ToNode field is the other end of the link (as the Edges map key is the first end)
type Graph ¶
Graph represents the graph structure, which has the list of Nodes and the Edges(links) between the Nodes
func (*Graph) GetEdgeValue ¶
GetEdgeValue : returns the value associated with the edge (x, y);
func (*Graph) GetNodeValue ¶
GetNodeValue : returns the value associated with the node x;
func (*Graph) Neighbors ¶
Neighbors : lists all nodes y such that there is an edge from the node x to the node y;
func (*Graph) RemoveEdge ¶
RemoveEdge : removes the edge from the node x to the node y, if it is there;
func (*Graph) RemoveNode ¶
RemoveNode : removes the node by ID, if it is there;
func (*Graph) SetEdgeValue ¶
SetEdgeValue : sets the value associated with the edge (x, y) to v.
func (*Graph) SetNodeValue ¶
SetNodeValue : sets the value associated with the node x to v.