hercules.v9: gopkg.in/src-d/hercules.v9/internal/toposort Index | Files

package toposort

import "gopkg.in/src-d/hercules.v9/internal/toposort"


Package Files


type Graph Uses

type Graph struct {
    // contains filtered or unexported fields

Graph represents a directed acyclic graph.

func NewGraph Uses

func NewGraph() *Graph

NewGraph initializes a new Graph.

func (*Graph) AddEdge Uses

func (g *Graph) AddEdge(from, to string) int

AddEdge inserts the link from "from" node to "to" node.

func (*Graph) AddNode Uses

func (g *Graph) AddNode(name string) bool

AddNode inserts a new node into the graph.

func (*Graph) AddNodes Uses

func (g *Graph) AddNodes(names ...string) bool

AddNodes inserts multiple nodes into the graph at once.

func (*Graph) BreadthSort Uses

func (g *Graph) BreadthSort() []string

BreadthSort sorts the nodes in the graph in BFS order.

func (*Graph) Copy Uses

func (g *Graph) Copy() *Graph

Copy clones the graph and returns the independent copy.

func (*Graph) DebugDump Uses

func (g *Graph) DebugDump() string

DebugDump converts the graph to a string. As the name suggests, useful for debugging.

func (*Graph) FindChildren Uses

func (g *Graph) FindChildren(from string) []string

FindChildren returns the other ends of outgoing edges.

func (*Graph) FindCycle Uses

func (g *Graph) FindCycle(seed string) []string

FindCycle returns the cycle in the graph which contains "seed" node.

func (*Graph) FindParents Uses

func (g *Graph) FindParents(to string) []string

FindParents returns the other ends of incoming edges.

func (*Graph) ReindexNode Uses

func (g *Graph) ReindexNode(node string)

ReindexNode updates the internal representation of the node after edge removals.

func (*Graph) RemoveEdge Uses

func (g *Graph) RemoveEdge(from, to string) bool

RemoveEdge deletes the link from "from" node to "to" node. Call ReindexNode(from) after you finish modifying the edges.

func (*Graph) Serialize Uses

func (g *Graph) Serialize(sorted []string) string

Serialize outputs the graph in Graphviz format.

func (*Graph) Toposort Uses

func (g *Graph) Toposort() ([]string, bool)

Toposort sorts the nodes in the graph in topological order.

Package toposort imports 4 packages (graph) and is imported by 1 packages. Updated 2019-04-26. Refresh now. Tools for package owners.