Movatterモバイル変換


[0]ホーム

URL:


unit

package
v2.28.4Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License:AGPL-3.0Imports:6Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeEdge

type Edge[EdgeType, VertexTypecomparable] struct {From VertexTypeTo   VertexTypeEdge EdgeType}

Edge is a convenience type for representing an edge in the graph.It encapsulates the from and to vertices and the edge type itself.

typeGraph

type Graph[EdgeType, VertexTypecomparable] struct {// contains filtered or unexported fields}

Graph provides a bidirectional interface over gonum's directed graph implementation.While the underlying gonum graph is directed, we overlay bidirectional semanticsby distinguishing between forward and reverse edges. Wanting and being wanted byother units are related but different concepts that have different graph traversalimplications when Units update their status.

The graph stores edge types to represent different relationships between units,allowing for domain-specific semantics beyond simple connectivity.

func (*Graph[EdgeType, VertexType])AddEdge

func (g *Graph[EdgeType, VertexType]) AddEdge(from, to VertexType, edge EdgeType)error

AddEdge adds an edge to the graph. It initializes the graph and metadata on first use,checks for cycles, and adds the edge to the gonum graph.

func (*Graph[EdgeType, VertexType])GetForwardAdjacentVertices

func (g *Graph[EdgeType, VertexType]) GetForwardAdjacentVertices(from VertexType) []Edge[EdgeType, VertexType]

GetForwardAdjacentVertices returns all the edges that originate from the given vertex.

func (*Graph[EdgeType, VertexType])GetReverseAdjacentVertices

func (g *Graph[EdgeType, VertexType]) GetReverseAdjacentVertices(to VertexType) []Edge[EdgeType, VertexType]

GetReverseAdjacentVertices returns all the edges that terminate at the given vertex.

func (*Graph[EdgeType, VertexType])ToDOT

func (g *Graph[EdgeType, VertexType]) ToDOT(namestring) (string,error)

ToDOT exports the graph to DOT format for visualization

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp