autogroup

package
v0.0.0-...-f342e06 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

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

func (ag *NonReachabilityGrouper) EdgeMerge(e1, e2 pgraph.Edge) pgraph.Edge

EdgeMerge can be overridden, since it just simple returns the first edge.

func (*NonReachabilityGrouper) Init

func (ag *NonReachabilityGrouper) Init(g *pgraph.Graph) error

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

func (ag *NonReachabilityGrouper) VertexCmp(v1, v2 pgraph.Vertex) error

VertexCmp can be used in addition to an overridding implementation.

func (*NonReachabilityGrouper) VertexMerge

func (ag *NonReachabilityGrouper) VertexMerge(v1, v2 pgraph.Vertex) (v pgraph.Vertex, err error)

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

func (ag *NonReachabilityGrouper) VertexTest(b bool) (bool, error)

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.

Jump to

Keyboard shortcuts

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