partialord

package
v8.0.0-...-2960480 Latest Latest
Warning

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

Go to latest
Published: May 27, 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) 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 It should not be externally exposed, and is intended to be a very simple dag implementation utilizing adjacency lists to store edges.
Package dag implements a simple Directed Acyclical Graph (DAG) for deterministic topological sorts It should not be externally exposed, and is intended to be a very simple dag implementation utilizing adjacency lists to store edges.

Jump to

Keyboard shortcuts

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