Documentation ¶
Index ¶
- type Graph
- func (g *Graph) AddEdge(from, to string) int
- func (g *Graph) AddNode(name string) bool
- func (g *Graph) AddNodes(names ...string) bool
- func (g *Graph) BreadthSort() []string
- func (g *Graph) Copy() *Graph
- func (g *Graph) DebugDump() string
- func (g *Graph) FindChildren(from string) []string
- func (g *Graph) FindCycle(seed string) []string
- func (g *Graph) FindParents(to string) []string
- func (g *Graph) ReindexNode(node string)
- func (g *Graph) RemoveEdge(from, to string) bool
- func (g *Graph) Serialize(sorted []string) string
- func (g *Graph) Toposort() ([]string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph represents a directed acyclic graph.
func (*Graph) BreadthSort ¶
BreadthSort sorts the nodes in the graph in BFS order.
func (*Graph) DebugDump ¶
DebugDump converts the graph to a string. As the name suggests, useful for debugging.
func (*Graph) FindChildren ¶
FindChildren returns the other ends of outgoing edges.
func (*Graph) FindParents ¶
FindParents returns the other ends of incoming edges.
func (*Graph) ReindexNode ¶
ReindexNode updates the internal representation of the node after edge removals.
func (*Graph) RemoveEdge ¶
RemoveEdge deletes the link from "from" node to "to" node. Call ReindexNode(from) after you finish modifying the edges.
Click to show internal directories.
Click to hide internal directories.