partialord

package
v12.0.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

package partialord allows one to define partial orderings, and derive a total ordering

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PartialOrdering

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

func NewPartialOrdering

func NewPartialOrdering(elements []string) PartialOrdering

NewPartialOrdering creates a new partial ordering over the set of provided elements.

func (*PartialOrdering) After

func (ord *PartialOrdering) After(A string, B string)

After marks that A should come after B

func (*PartialOrdering) Before

func (ord *PartialOrdering) Before(A string, B string)

After marks that A should come before B

func (*PartialOrdering) FirstElements

func (ord *PartialOrdering) FirstElements(elems ...string)

Sets elems to be the first elements in the ordering. So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} then we are guaranteed that the total ordering will begin with {D, B, A}

func (*PartialOrdering) LastElements

func (ord *PartialOrdering) LastElements(elems ...string)

Sets elems to be the last elements in the ordering. So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} then we are guaranteed that the total ordering will end with {D, B, A}

func (*PartialOrdering) Sequence

func (ord *PartialOrdering) Sequence(seq ...string)

Sequence sets a sequence of ordering constraints. So if were making an ordering over {A, B, C, D, E}, and elems provided is {D, B, A} then we are guaranteed that the total ordering will have D comes before B comes before A. (They're may be elements interspersed, e.g. {D, C, E, B, A} is a valid ordering)

func (*PartialOrdering) TotalOrdering

func (ord *PartialOrdering) TotalOrdering() []string

TotalOrdering returns a deterministically chosen total ordering that satisfies all specified partial ordering constraints.

Panics if no total ordering exists.

Directories

Path Synopsis
internal
dag
Package dag implements a simple Directed Acyclical Graph (DAG) for deterministic topological sorts
Package dag implements a simple Directed Acyclical Graph (DAG) for deterministic topological sorts

Jump to

Keyboard shortcuts

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