Documentation ¶
Index ¶
- type Edge
- type Edges
- func (e Edges) AddEdge(edge Edge)
- func (e Edges) DelEdge(id ID)
- func (e Edges) Filter(fn func(e Edge) bool) []Edge
- func (e Edges) FilterType(typ string, fn func(e Edge) bool) []Edge
- func (e Edges) GetEdge(id ID) (Edge, bool)
- func (e Edges) HasEdge(id ID) bool
- func (e Edges) Len(typ string) int
- func (e Edges) Range(fn func(e Edge) bool)
- func (e Edges) RangeType(typ string, fn func(e Edge) bool)
- func (e Edges) Types() []string
- type Graph
- type ID
- type Map
- func (m Map) Copy() Map
- func (m Map) Del(k interface{})
- func (m Map) Exists(key interface{}) bool
- func (m Map) Filter(filter func(k, v interface{}) bool) Map
- func (m Map) Get(k interface{}) (interface{}, bool)
- func (m Map) Intersection(other Map) Map
- func (m Map) Range(iterator func(k, v interface{}) bool)
- func (m Map) Set(k, v interface{})
- func (m Map) Union(other Map) Map
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge interface { // An edge implements Node because it has an Identifier and attributes Node // From returns the root node of the edge From() Node // To returns the target node of the edge To() Node }
Edge is a relationship between two nodes
type Edges ¶
Edges is a map of edges. Edges are not concurrency safe.
func (Edges) Filter ¶ added in v0.5.2
Filter executes the function over every edge. If the function returns true, the edges will be added to the returned array of edges.
func (Edges) FilterType ¶ added in v0.5.2
FilterType executes the function over every edge of the given type. If the function returns true, the edges will be added to the returned array of edges.
func (Edges) Range ¶ added in v0.5.1
Range executes the function over every edge. If the function returns false, the iteration stops.
type Graph ¶
type Graph interface { // AddNode adds a single node to the graph AddNode(n Node) // AddNodes adds multiple nodes to the graph AddNodes(nodes ...Node) // GetNode gets a node from the graph if it exists GetNode(id ID) (Node, bool) // DelNode deletes the nodes and it's edges DelNode(id ID) // HasNode returns true if the node exists in the graph HasNode(id ID) bool // NodeTypes returns an array of Node types that exist in the graph NodeTypes() []string // RangeNodeTypes ranges over every node of the given type until the given function returns false RangeNodeTypes(typ string, fn func(n Node) bool) // RangeNodes ranges over every node until the given function returns false RangeNodes(fn func(n Node) bool) // AddEdge adds an edge to the graph between the two nodes. It returns an error if one of the nodes does not exist. AddEdge(e Edge) error // AddEdges adds all of the edges to the graph AddEdges(e Edges) error // GetEdge gets the edge by id if it exists GetEdge(id ID) (Edge, bool) // HasEdge returns true if the edge exists in the graph HasEdge(id ID) bool // DelEdge deletes the edge DelEdge(id ID) // DelEdges deletes all the edges at once DelEdges(e Edges) error // RangeEdges ranges over every edge until the given function returns false RangeEdges(fn func(e Edge) bool) // RangeEdgeTypes ranges over every edge of the given type until the given function returns false RangeEdgeTypes(typ string, fn func(e Edge) bool) // EdgesFrom returns all of the edges the point from the given node identifier EdgesFrom(id ID) (Edges, bool) // EdgesTo returns all of the edges the point to the given node identifier EdgesTo(id ID) (Edges, bool) // EdgeTypes returns all of the edge types in the Graph EdgeTypes() []string // Close removes all entries from the cache Close() }
Graph is a concurrency safe directed Graph datastructure
type ID ¶ added in v0.5.1
type Map ¶
type Map map[interface{}]interface{}
Map is a functional map for storing arbitrary data. It is not concurrency safe
func (Map) Intersection ¶
Intersection returns the values that exist in both maps ref: https://en.wikipedia.org/wiki/Intersection_(set_theory)#:~:text=In%20mathematics%2C%20the%20intersection%20of,that%20also%20belong%20to%20A).