color

package
v0.0.0-...-8b501b0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assigner

type Assigner struct {
	// contains filtered or unexported fields
}

Assigner implements the greedy Jones/Plassmann algorithm for coloring graphs.

func NewColorAssigner

func NewColorAssigner(numWorkers int) (*Assigner, error)

NewColorAssigner returns a new color Assigner instance.

func (*Assigner) AddPreColoredVertex

func (c *Assigner) AddPreColoredVertex(id string, color int)

AddPreColoredVertex inserts a new vertex with a pre-assigned color.

func (*Assigner) AddUndirectedEdge

func (c *Assigner) AddUndirectedEdge(srcID, dstID string) error

AddUndirectedEdge creates an un-directed edge from srcID to dstID.

func (*Assigner) AddVertex

func (c *Assigner) AddVertex(id string)

AddVertex inserts a new vertex with the specified ID into the graph.

func (*Assigner) AssignColors

func (c *Assigner) AssignColors(ctx context.Context, visitor func(vertexID string, color int)) (int, error)

AssignColors executes the Jones/Plassmann algorithm on the graph and invokes the user-defined visitor function for each vertex in the graph.

func (*Assigner) Close

func (c *Assigner) Close() error

Close cleans up any allocated graph resources.

func (*Assigner) Graph

func (c *Assigner) Graph() *bspgraph.Graph

Graph returns the underlying bspgraph.Graph instance.

func (*Assigner) SetExecutorFactory

func (c *Assigner) SetExecutorFactory(factory bspgraph.ExecutorFactory)

SetExecutorFactory configures the calculator to use the a custom executor factory when AssignColors is invoked.

type VertexStateMessage

type VertexStateMessage struct {
	ID    string
	Token int
	Color int
}

VertexStateMessage is used to advertise the state of a vertex to its neighbors.

func (*VertexStateMessage) Type

func (m *VertexStateMessage) Type() string

Type returns the type of this message.

Jump to

Keyboard shortcuts

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