options

package
v0.0.0-...-656df2e Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoType = struct{}{}
)

Functions

This section is empty.

Types

type CrossGraphEdges

type CrossGraphEdges int

CrossGraphEdges defines whether the graph allows edges across graphs (edges connecting nodes that do not share the same parent graph)

const (
	WithCrossGraphEdges CrossGraphEdges = iota
	NoCrossGraphEdges
)

func (CrossGraphEdges) Apply

func (s CrossGraphEdges) Apply(c *GraphConfig)

type CycleSetting

type CycleSetting int

CycleSetting defines whether the graph allows cycles or not

const (
	Cyclical CycleSetting = iota
	NonCyclical
)

func (CycleSetting) Apply

func (s CycleSetting) Apply(c *GraphConfig)

type DepthLimit

type DepthLimit int

DepthLimit defines the maximum depth a graph can have (depth 3: root->a->b->c)

func (DepthLimit) Apply

func (s DepthLimit) Apply(c *GraphConfig)

type DirectionSetting

type DirectionSetting int

DirectionSetting defines whether the graph is directed or undirected

const (
	Directional DirectionSetting = iota
	NonDirectional
)

func (DirectionSetting) Apply

func (s DirectionSetting) Apply(c *GraphConfig)

type GraphConfig

type GraphConfig struct {
	GraphType         TypeSetting
	IsNonDirectional  bool
	IsNonCyclical     bool
	IsUnweighted      bool
	Immutable         bool
	ReadOnly          bool
	WeightAsDistance  bool
	NoCrossGraphEdges bool
	MaxNodes          int
	MaxDepth          int
	IDConstraint      reflect.Type
}

GraphConfig defines how a graph can be configured

func New

func New(s ...Setting) *GraphConfig

New function creates a new pointer to a GraphConfig from the list of input Setting provided

func (*GraphConfig) Apply

func (c *GraphConfig) Apply(t *GraphConfig)

Apply overrides a pointer to a GraphConfig with this GraphConfig's settings

type Mutability

type Mutability int

Mutability defines whether the graph can be altered (update / delete actions) or not

const (
	Mutable Mutability = iota
	Immutable
)

func (Mutability) Apply

func (s Mutability) Apply(c *GraphConfig)

type NodeLimit

type NodeLimit int

NodeLimit defines the number of nodes the graph can hold

func (NodeLimit) Apply

func (s NodeLimit) Apply(c *GraphConfig)

type Setting

type Setting interface {
	// Apply sets this option in the input GraphConfig pointer
	Apply(*GraphConfig)
}

Setting describes a configurable option

var (
	// CfgAdjacencyList defines the basic configuration of an adjacency list graph
	CfgAdjacencyList Setting = MultiOption(
		GraphList,
		WithCrossGraphEdges,
	)
	// CfgAdjacencyMatrix defines the basic configuration of an adjacency matrix graph
	CfgAdjacencyMatrix Setting = MultiOption(
		GraphMatrix,
		NoCrossGraphEdges,
	)
	// CfgKnowledgeGraph defines the basic configuration of a knowledge graph
	CfgKnowledgeGraph Setting = MultiOption(
		GraphKnowledge,
		WithCrossGraphEdges,
	)
	// CfgLinkedList defines the basic configuration of a linked list type of graph
	CfgLinkedList Setting = MultiOption(
		GraphList,
		Unweighted,
		NonCyclical,
		Directional,
		MaxNodes(1),
	)
	// CfgDualLinkedList defines the basic configuration of a linked list type of graph, that
	// links child nodes to their parents, too
	CfgDualLinkedList Setting = MultiOption(
		GraphList,
		Unweighted,
		NonCyclical,
		NonDirectional,
		MaxNodes(1),
	)
)

func MaxDepth

func MaxDepth(v int) Setting

func MaxNodes

func MaxNodes(v int) Setting

func MultiOption

func MultiOption(opts ...Setting) Setting

MultiOption function will return a single Setting wrapping the input Setting provided

type TypeSetting

type TypeSetting int

TypeSetting defines the graph type (adjacency list, adjacency matrix and knowledge graph)

const (
	GraphList TypeSetting = iota
	GraphMatrix
	GraphKnowledge
)

func (TypeSetting) Apply

func (s TypeSetting) Apply(c *GraphConfig)

type WeightAsDistance

type WeightAsDistance int

WeightAsDistance defines whether the dot output sets the weight as a weight property (as distance) or a label property

const (
	LabelWeight WeightAsDistance = iota
	DistanceWeight
)

func (WeightAsDistance) Apply

func (s WeightAsDistance) Apply(c *GraphConfig)

type WeightedEdges

type WeightedEdges int

WeightedEdges defines whether the graph allows edge weights or not

const (
	Weighted WeightedEdges = iota
	Unweighted
)

func (WeightedEdges) Apply

func (s WeightedEdges) Apply(c *GraphConfig)

type WritePrivilege

type WritePrivilege int

WritePrivilege defines whether the graph can be written to (create / update / delete) once connected to a parent, or not

const (
	ReadWrite WritePrivilege = iota
	ReadOnly
)

func (WritePrivilege) Apply

func (s WritePrivilege) Apply(c *GraphConfig)

Jump to

Keyboard shortcuts

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