Documentation ¶
Index ¶
- Constants
- type EdgeType
- type Graph
- func (g *Graph) AddEdge(edgeType EdgeType, src, dest any)
- func (g *Graph) AddVertex(vertex any, weight uint)
- func (g *Graph) Clean()
- func (g *Graph) HasVertex(plugin any) bool
- func (g *Graph) Remove(plugin any) []*Vertex
- func (g *Graph) TopologicalOrder() []*Vertex
- func (g *Graph) TopologicalSort()
- func (g *Graph) VertexById(plugin any) *Vertex
- func (g *Graph) Vertices() []*Vertex
- func (g *Graph) WriteDotString()
- type Vertex
- type VertexHeap
Constants ¶
View Source
const (
// InitMethodName is the function fn for the reflection
InitMethodName = "Init"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph manages the set of services and their edges type of the VerticesMap: directed
func New ¶
func New() *Graph
New initializes endure Graph According to the topological sorting, graph should be 1. DIRECTED 2. ACYCLIC
func (*Graph) AddVertex ¶
AddVertex adds an vertex to the graph with its ID, value and meta information
func (*Graph) HasVertex ¶
HasVertex returns true or false if the vertex exists in the vertices map in the graph
func (*Graph) TopologicalOrder ¶
func (*Graph) TopologicalSort ¶
func (g *Graph) TopologicalSort()
func (*Graph) VertexById ¶
func (*Graph) WriteDotString ¶
func (g *Graph) WriteDotString()
type Vertex ¶
type Vertex struct {
// contains filtered or unexported fields
}
Vertex is main vertex representation for the graph since we can have cyclic dependencies when we traverse the VerticesMap, we should mark nodes as visited or not to detect cycle
type VertexHeap ¶
type VertexHeap []*Vertex
func (*VertexHeap) Len ¶
func (h *VertexHeap) Len() int
func (*VertexHeap) Less ¶
func (h *VertexHeap) Less(i, j int) bool
func (*VertexHeap) Pop ¶
func (h *VertexHeap) Pop() interface{}
func (*VertexHeap) Push ¶
func (h *VertexHeap) Push(x interface{})
func (*VertexHeap) Swap ¶
func (h *VertexHeap) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.