Documentation ¶
Overview ¶
Package graph provides a directed multi-graph with class nodes and rule edges.
Index ¶
- func ClassFor(n graph.Node) korrel8r.Class
- func RuleFor(l graph.Line) korrel8r.Rule
- type Attrs
- type Data
- type Edge
- type Graph
- func (g *Graph) AllLines() (lines []*Line)
- func (g *Graph) AllNodes() (nodes []*Node)
- func (g *Graph) AllPaths(start korrel8r.Class, goals ...korrel8r.Class) *Graph
- func (g *Graph) DOTAttributers() (graph, node, edge encoding.Attributer)
- func (g *Graph) DOTID() string
- func (g *Graph) EachEdge(visit func(*Edge))
- func (g *Graph) EachLine(visit func(*Line))
- func (g *Graph) EachNode(visit func(*Node))
- func (g *Graph) LinesBetween(u, v *Node) (lines []*Line)
- func (g *Graph) LinesTo(v *Node) (lines []*Line)
- func (g *Graph) Neighbours(start korrel8r.Class, depth int, f func(*Line) bool) *Graph
- func (g *Graph) NodeFor(c korrel8r.Class) *Node
- func (g *Graph) NodesFor(classes ...korrel8r.Class) (nodes []*Node)
- func (g *Graph) NodesSubgraph(nodes []graph.Node) *Graph
- func (g *Graph) Select(keep func(l *Line) bool) *Graph
- func (g *Graph) ShortestPaths(start korrel8r.Class, goals ...korrel8r.Class) *Graph
- func (g *Graph) Traverse(start korrel8r.Class, goals []korrel8r.Class, f func(*Line) bool) *Graph
- type Line
- type Node
- type Queries
- type QueryCount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Data ¶
type Data struct { Nodes []*Node // Nodes slice index == Node.ID() Lines []*Line // Lines slice index == Line.ID() // contains filtered or unexported fields }
Data contains a set of class nodes and rule lines to be used in rule/class graphs. Graphs based on the same Data have consistent node and line IDs.
Concurrency: Data is immutable once created.
func NewData ¶
NewData creates a new data set from a list of rules.
Concurrency: Data is immutable once created.
type Graph ¶
type Graph struct { *multi.DirectedGraph GraphAttrs, NodeAttrs, EdgeAttrs Attrs Data *Data // contains filtered or unexported fields }
Graph is a directed multigraph with korrel8r.Class noes and korrel8r.Rule lines. Nodes and lines carry attributes for rendering by GraphViz.
Concurrency: Graph is mutable, normal concurrency rules apply regarding read/write operations.
func (*Graph) AllPaths ¶
AllPaths returns a new sub-graph containing all paths between start and goal.
func (*Graph) DOTAttributers ¶
func (g *Graph) DOTAttributers() (graph, node, edge encoding.Attributer)
func (*Graph) LinesBetween ¶
func (*Graph) Neighbours ¶
Neighbours traverses a breadth-first neighbourhood of start. Returns the subset of the graph that was traversed.
func (*Graph) NodesSubgraph ¶
NodesSubgraph returns a new graph containing nodes and all lines between them.
func (*Graph) ShortestPaths ¶
ShortestPaths returns a new sub-graph containing all shortest paths between start and goals.
type Line ¶
type Line struct { multi.Line Attrs // GraphViz Attributer Rule korrel8r.Rule Queries Queries // Queries generated by Rule }
Line is one line in a multi-graph edge, corresponds to a rule.
type Node ¶
type Node struct { multi.Node Attrs // GraphViz Attributer Class korrel8r.Class Result korrel8r.Result // Accumulate incoming query results. Queries Queries // All queries leading to this node. }
Node is a graph Node, contains a Class.
type Queries ¶ added in v0.1.2
type Queries map[string]QueryCount
Queries is a map of QueryCount by Query name.
type QueryCount ¶
QueryCount records count of objects resulting from a query. Count == -1 means the query has not been evaluated.