Documentation
¶
Index ¶
- Constants
- type Graph
- func (g *Graph) BFS(node *Node) []*Node
- func (g *Graph) DFS(node *Node) []*Node
- func (g *Graph) MakeEdge(from, to *Node, weight float32) error
- func (g *Graph) MakeNode(value interface{}) *Node
- func (g *Graph) Neighbors(node *Node) []*Node
- func (g *Graph) RemoveEdge(from, to *Node) error
- func (g *Graph) RemoveNode(node *Node)
- type Node
Constants ¶
View Source
const ( Undirected int = iota Directed )
GraphType values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
Graph .
func (*Graph) MakeEdge ¶
MakeEdge creates an edge in the graph with a corresponding weight. It returns an error if either of the nodes do not belong in the graph.
func (*Graph) Neighbors ¶
Neighbors returns a slice of nodes that are reachable from the given node in a graph.
func (*Graph) RemoveEdge ¶
RemoveEdge removes edges starting at the from node and ending at the to node.
func (*Graph) RemoveNode ¶
RemoveNode removes a node from the graph and all edges connected to it.
Click to show internal directories.
Click to hide internal directories.