knowledge

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 2 Imported by: ? modules, 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 knowledge provides protocol knowledge graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	From     string       `json:"from"`
	To       string       `json:"to"`
	Relation RelationType `json:"relation"`
}

Edge represents a knowledge graph edge.

type Graph

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

Graph represents a protocol knowledge graph.

func NewGraph

func NewGraph() *Graph

NewGraph creates a new knowledge graph.

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to string, rel RelationType)

AddEdge adds an edge.

func (*Graph) AddNode

func (g *Graph) AddNode(id, typ, name string)

AddNode adds a node.

func (*Graph) Describe

func (g *Graph) Describe() string

Describe returns a text description.

func (*Graph) Query

func (g *Graph) Query(nodeID string) []Edge

Query finds nodes related to a given node.

func (*Graph) ToMermaid

func (g *Graph) ToMermaid() string

ToMermaid generates a Mermaid graph.

type Node

type Node struct {
	ID   string `json:"id"`
	Type string `json:"type"` // protocol, rfc, org, usecase
	Name string `json:"name"`
}

Node represents a knowledge graph node.

type RelationType

type RelationType string

RelationType represents a relationship type.

const (
	RelEncapsulates RelationType = "encapsulates"
	RelDefinedBy    RelationType = "defined_by"
	RelUsedIn       RelationType = "used_in"
	RelSucceeds     RelationType = "succeeds"
)

Jump to

Keyboard shortcuts

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