path

package
v0.0.0-...-b1f7850 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2014 License: MIT Imports: 2 Imported by: 0

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

func BuildCC

func BuildCC(g graph.Graph) CC

BuildCC builds a Connected Component representation of graph g

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.

func BuildDFO

func BuildDFO(di graph.Digraph) *DFO

BuildDFO constructs a depth first order representation of digraph di.

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

func BuildBFS

func BuildBFS(g graph.Graph, s int) PathFinder

BuildBFS builds a Breath First Search PathFinder for graph g starting from source s

func BuildDFS

func BuildDFS(g graph.Graph, s int) PathFinder

BuildDFS builds a depth first search PathFinder for graph g starting from source s

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

func BuildSCC

func BuildSCC(di graph.Digraph) SCC

BuildSCC builds a Strongly Connected Component representation of digraph di using the Kosaraju Sharir algorithm.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL