Documentation
¶
Overview ¶
Package graph has all the Graph logic that we need to interact with Graph, Node and Edge.
Index ¶
- type Edge
- type Graph
- func (g *Graph) AddEdge(e *Edge) error
- func (g *Graph) AddNode(n *Node) error
- func (g *Graph) Clean()
- func (g *Graph) GetEdgesForNode(nID string) []*Edge
- func (g *Graph) GetNodeByCanonical(nCan string) (*Node, error)
- func (g *Graph) GetNodeByID(nID string) (*Node, error)
- func (g *Graph) InvertEdge(eID string)
- func (g *Graph) RemoveNodeByID(ID string) error
- func (g *Graph) Replace(srcID, repID string) error
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
ID string
Canonicals []string
Source string
Target string
// contains filtered or unexported fields
}
Edge defines the standard format of an Edge
func (*Edge) AddCanonicals ¶
AddCanonicals adds the cans to the internal list, if one is repeated it'll be ignored
type Graph ¶
Graph defines the standard format of a Graph
func (*Graph) GetEdgesForNode ¶
GetEdgesForNode returns all the edges that have relation to this nID
func (*Graph) GetNodeByCanonical ¶ added in v0.4.0
GetNodeByCanonical returns the requested Node with the nCan
func (*Graph) GetNodeByID ¶
GetNodeByID returns the requested Node with the nID
func (*Graph) InvertEdge ¶
InvertEdge inverts the Source and Target of the eID
func (*Graph) RemoveNodeByID ¶ added in v0.3.0
RemoveNodeByID removes the Node with the ID and the Edges associated with it
type Node ¶
type Node struct {
// ID it'a a random UUID
ID string
// Canonical it's 'aws_lb.front' format
Canonical string
// Name it's the name of the resource
Name string
// Position holds the position of the node if any
Position []int // x, y
// TFID it's the internal ID it has on TF
TFID string
// Resource it's the information of the resource
// it holds
Resource resource.Resource
// Weight is the addition of the Directions
// of the Node
Weight int
}
Node defines the standard format of an Edge
Click to show internal directories.
Click to hide internal directories.