dag

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAG

type DAG struct {
	Nodes []Node `json:"nodes"`
	Edges []Edge `json:"edges"`
}

DAG represents a dependency graph between segments.

func Build

func Build(segments []model.Segment, source []byte) DAG

Build constructs a DAG from segments by detecting cross-references.

func (DAG) ExportDOT

func (d DAG) ExportDOT() string

ExportDOT exports the DAG as a Graphviz DOT string.

func (DAG) ExportIndexMarkdown

func (d DAG) ExportIndexMarkdown(filenames []string) string

ExportIndexMarkdown exports a Markdown index listing all segments and their dependencies. filenames[i] is the filename for node i.

func (DAG) ExportJSON

func (d DAG) ExportJSON() ([]byte, error)

ExportJSON exports the DAG as JSON.

type Edge

type Edge struct {
	From int    `json:"from"`
	To   int    `json:"to"`
	Type string `json:"type"` // "anchor", "link"
}

Edge represents a dependency between segments.

type Node

type Node struct {
	ID      int      `json:"id"`
	Label   string   `json:"label"`
	Anchors []string `json:"anchors,omitempty"`
}

Node represents a segment in the DAG.

Jump to

Keyboard shortcuts

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