partialord

package
v2.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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)

Before marks that A should come before B

func (*PartialOrdering) FirstElements

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

FirstElements 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)

LastElements 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