Documentation ¶
Index ¶
- type Edge
- type Graph
- func (g *Graph) AddEdge(e *Edge) error
- func (g *Graph) AddNode(n *Node) error
- func (g *Graph) ChildsOf(n int) []int
- func (g *Graph) DeleteEdge(id int) error
- func (g *Graph) DeleteNode(id int) error
- func (g *Graph) Empty() bool
- func (g Graph) Equal(g2 *Graph) bool
- func (g *Graph) FindEdgeByID(ID int) (*Edge, error)
- func (g *Graph) FindEdgesFromTo(IDFrom, IDTo int) []*Edge
- func (g *Graph) FindNodeByID(ID int) (*Node, error)
- func (g *Graph) FindSubGraph(startIDs, endIDs []int) (*Graph, error)
- func (g *Graph) Load(path string) error
- func (g *Graph) ParentsOf(n int) []int
- func (g *Graph) PrintGraphviz() error
- func (g *Graph) Save(path string) error
- func (g Graph) ToString() string
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
Edge is the data structure to connect nodes inside the graph.
type Graph ¶
Graph holds the data of the graph with all it's Nodes and edges.
func (*Graph) DeleteEdge ¶
DeleteEdge deletes an edge from the graph if it is present
func (*Graph) DeleteNode ¶
DeleteNode deletes an Node from the graph if it is present
func (*Graph) Empty ¶
Empty returns true if the root Node is the only Node in the graph, false otherwise
func (*Graph) FindEdgeByID ¶
FindEdgeByID finds a Edge in the graph by it's ID
func (*Graph) FindEdgesFromTo ¶
FindEdgesFromTo finds an endge in the graph by it's start and end
func (*Graph) FindNodeByID ¶
FindNodeByID finds a node in the graph by it's ID
func (*Graph) FindSubGraph ¶
FindSubGraph returns a subset of the graph (a subgraph) with the shortest way from the start nodes to the end nodes if possible. If no possible connection is found, an error is returned
func (*Graph) PrintGraphviz ¶
PrintGraphviz generates a graph in the dot language to be visualized using graphviz