Documentation
¶
Index ¶
- Constants
- type DirectedEdge
- type DirectedWeightedEdge
- type Edge
- type Graphy
- func (g *Graphy) AddEdge(parent, child *Node, value interface{}, weight float64) (err error)
- func (g *Graphy) AddNode(node *Node) (err error)
- func (g *Graphy) Bipartite() (isBipartite bool)
- func (g *Graphy) DAG() (isDAG bool)
- func (g *Graphy) Export(ctx context.Context) string
- func (g *Graphy) Mutual(n1 Node, n2 Node) (mutual bool)
- func (g *Graphy) Node(value interface{}) (node *Node, err error)
- func (g *Graphy) Nodes(ctx context.Context) <-chan *Node
- func (g *Graphy) RemoveEdge(parent *Node, child *Node) (err error)
- func (g *Graphy) RemoveNode(value interface{}) (err error)
- func (g *Graphy) Size() int
- func (g *Graphy) String(ctx context.Context) string
- func (g *Graphy) Strong() (isStrong bool)
- func (g *Graphy) UpdateEdge(parent *Node, child *Node, value interface{}, weight int) (err error)
- type Heap
- func (h *Heap) ChangeCost(value interface{}, parent *Node, cost float64)
- func (h *Heap) Delete(i int) (err error)
- func (h *Heap) DeleteElem(value interface{}) (err error)
- func (h *Heap) Down(i int)
- func (h *Heap) ExtractMin() (min *Node, err error)
- func (h *Heap) Find(value interface{}) (index int, err error)
- func (h *Heap) Insert(n *Node) (err error)
- func (h *Heap) Min() (index int, err error)
- func (h *Heap) Print()
- func (h *Heap) Size() int
- func (h *Heap) Swap(i, j int)
- func (h *Heap) Up(i int)
- type Node
- func (n *Node) AddEdge(relation *Node, edge Edge) (err error)
- func (n *Node) AllReachable(ctx context.Context, alg int) <-chan *Node
- func (n *Node) DirectMutual(node Node) (mutual bool)
- func (n *Node) Edges(ctx context.Context) <-chan Edge
- func (n *Node) Export(ctx context.Context) string
- func (n *Node) Reachable(ctx context.Context, alg int, node *Node) (reachable bool)
- func (n *Node) String(ctx context.Context) string
- type WeightedEdge
Constants ¶
const ( // BFS is the constant for Breadth First Search BFS = iota // DFS is the constant for Depth First Search DFS = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirectedEdge ¶
DirectedEdge is the interface that defines a directional edge in the graph
type DirectedWeightedEdge ¶
type DirectedWeightedEdge interface {
DirectedEdge
Weight() float64
}
DirectedWeightedEdge is the interface that defines a directional weighted edge in the graph
type Graphy ¶
Graphy is the graphy struct for building and searching the graph
func (*Graphy) Mutual ¶
Mutual accepts two nodes of the graph and determines if they're mutually reachable
func (*Graphy) Node ¶
Node adds a new node to the graph if it doesn't already exist and returns the node if the node already exists then it returns the node object from the map
func (*Graphy) Nodes ¶
Nodes returns a full set of the nodes in the graph with their associated edges
func (*Graphy) RemoveEdge ¶
RemoveEdge removes an edge from the graph
func (*Graphy) RemoveNode ¶
RemoveNode removes a node from the graph and removes all edges that reference that node
type Heap ¶
type Heap struct {
// contains filtered or unexported fields
}
func (*Heap) ChangeCost ¶
func (*Heap) DeleteElem ¶
func (*Heap) ExtractMin ¶
type Node ¶
type Node struct {
Value interface{}
Parent *Node
Cost float64
// contains filtered or unexported fields
}
Node is the interface representation of a node in the graph
func (*Node) AllReachable ¶
AllReachable returns all of the nodes that are accessible from this node the algorithm passed in is based off of the algorithms defined in the CONST files for search constants. Defaults to BFS.
func (*Node) DirectMutual ¶
DirectMutual determines if a specific node is directly mutual to this node
type WeightedEdge ¶
WeightedEdge is the interface that defines an undirected weighted edge in the graph