Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CC ¶
type CC interface {
// Connected tells whether vertices v and w are connected
Connected(v, w int) bool
// Count is the number of components in the graph
Count() int
// ID of the component containing vertex v
ID(v int) int
}
CC holds a representation of the connected components in a graph
type DFO ¶
type DFO struct {
// Pre is a slice of the vertices in preorder.
Pre []int
// Post is a slice of the vertices in postorder.
Post []int
// ReversePost is a slive of the vertices in reverse postorder.
ReversePost []int
}
DFO holds information regarding the ordered paths in a graph when traversed in depth-first search.
type PathFinder ¶
type PathFinder interface {
// HasPathTo tells whether there is a path between the source and the
// destination
HasPathTo(destination int) bool
// PathTo returns the path from the source to the destination
PathTo(destination int) []int
}
PathFinder holds information regarding the paths in a graph from a source
type SCC ¶
type SCC interface {
// Connected tells whether vertices v and w are connected
StronglyConnected(v, w int) bool
// Count is the number of components in the digraph
Count() int
// ID of the component containing vertex v
ID(v int) int
}
SCC holds a representation of the strongly connected components in a directed graph
type TransitiveClosure ¶
type TransitiveClosure struct {
// contains filtered or unexported fields
}
TransitiveClosure answers queries of the form "Is there a directed path from vertex v to vertex w?".
func BuildTransitiveClosure ¶
func BuildTransitiveClosure(di graph.Digraph) *TransitiveClosure
BuildTransitiveClosure builds a model of all-pair reachable vertices using depth-first search path finders.
func (*TransitiveClosure) Reachable ¶
func (t *TransitiveClosure) Reachable(v, w int) bool
Reachable tells if vertex w is reachable from vertex v.
Click to show internal directories.
Click to hide internal directories.