Documentation
¶
Index ¶
- func AutoGroup(ag engine.AutoGrouper, g *pgraph.Graph, debug bool, ...) error
- func VertexMerge(g *pgraph.Graph, v1, v2 pgraph.Vertex, ...) error
- type NonReachabilityGrouper
- func (ag *NonReachabilityGrouper) EdgeMerge(e1, e2 pgraph.Edge) pgraph.Edge
- func (ag *NonReachabilityGrouper) Init(g *pgraph.Graph) error
- func (ag *NonReachabilityGrouper) Name() string
- func (ag *NonReachabilityGrouper) VertexCmp(v1, v2 pgraph.Vertex) error
- func (ag *NonReachabilityGrouper) VertexMerge(v1, v2 pgraph.Vertex) (v pgraph.Vertex, err error)
- func (ag *NonReachabilityGrouper) VertexNext() (v1, v2 pgraph.Vertex, err error)
- func (ag *NonReachabilityGrouper) VertexTest(b bool) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoGroup ¶
func AutoGroup(ag engine.AutoGrouper, g *pgraph.Graph, debug bool, logf func(format string, v ...interface{})) error
AutoGroup is the mechanical auto group "runner" that runs the interface spec. TODO: this algorithm may not be correct in all cases. replace if needed!
func VertexMerge ¶
func VertexMerge(g *pgraph.Graph, v1, v2 pgraph.Vertex, vertexMergeFn func(pgraph.Vertex, pgraph.Vertex) (pgraph.Vertex, error), edgeMergeFn func(pgraph.Edge, pgraph.Edge) pgraph.Edge) error
VertexMerge merges v2 into v1 by reattaching the edges where appropriate, and then by deleting v2 from the graph. Since more than one edge between two vertices is not allowed, duplicate edges are merged as well. An edge merge function can be provided if you'd like to control how you merge the edges!
Types ¶
type NonReachabilityGrouper ¶
type NonReachabilityGrouper struct {
// contains filtered or unexported fields
}
NonReachabilityGrouper is the most straight-forward algorithm for grouping. TODO: this algorithm may not be correct in all cases. replace if needed!
func (*NonReachabilityGrouper) EdgeMerge ¶
EdgeMerge can be overridden, since it just simply returns the first edge.
func (*NonReachabilityGrouper) Init ¶
Init is called only once and before using other AutoGrouper interface methods the name method is the only exception: call it any time without side effects!
func (*NonReachabilityGrouper) Name ¶
func (ag *NonReachabilityGrouper) Name() string
Name returns the name for the grouper algorithm.
func (*NonReachabilityGrouper) VertexCmp ¶
VertexCmp can be used in addition to an overridding implementation.
func (*NonReachabilityGrouper) VertexMerge ¶
VertexMerge needs to be overridden to add the actual merging functionality.
func (*NonReachabilityGrouper) VertexNext ¶
func (ag *NonReachabilityGrouper) VertexNext() (v1, v2 pgraph.Vertex, err error)
VertexNext iteratively finds vertex pairs with simple graph reachability... This algorithm relies on the observation that if there's a path from a to b, then they *can't* be merged (b/c of the existing dependency) so therefore we merge anything that *doesn't* satisfy this condition or that of the reverse!
func (*NonReachabilityGrouper) VertexTest ¶
VertexTest processes the results of the grouping for the algorithm to know return an error if something went horribly wrong, and bool false to stop.