Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory interface {
// New returns a new graph
New() Graph
}
Factory creates new graphs
type Graph ¶
type Graph interface {
// Add adds a vertex to the graph
Add(vertex ids.ID)
// Remove removes a vertex from the graph
Remove(vertex ids.ID)
// AddEdge adds an edge from u to v
AddEdge(u, v ids.ID)
// RemoveEdge removes the edge from u to v
RemoveEdge(u, v ids.ID)
// Neighbors returns the neighbors of a vertex
Neighbors(vertex ids.ID) set.Set[ids.ID]
// HasEdge returns true if there is an edge from u to v
HasEdge(u, v ids.ID) bool
// Vertices returns all vertices in the graph
Vertices() set.Set[ids.ID]
// Len returns the number of vertices
Len() int
}
Graph represents a directed graph
type Topological ¶
type Topological interface {
Graph
// TopologicalSort returns a topological ordering of the graph
TopologicalSort() ([]ids.ID, error)
// HasCycle returns true if the graph has a cycle
HasCycle() bool
// StronglyConnectedComponents returns the strongly connected components
StronglyConnectedComponents() []set.Set[ids.ID]
}
Topological provides topological operations on graphs
Click to show internal directories.
Click to hide internal directories.