component

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	From string
	To   string
	//The file in which the connection is made. The from side.
	File  string
	Begin *file.Position
	End   *file.Position
}

Connection is a connection between two components.

func GetConnections

func GetConnections(snippetsByType file.SnippetGroup, snippetsByComponent file.SnippetGroup) []*Connection

type Cycle added in v0.1.0

type Cycle []string

type Graph

type Graph struct {
	Components []string

	Connections     []*Connection
	ConnectionsTo   map[string][]*Connection
	ConnectionsFrom map[string][]*Connection
	// contains filtered or unexported fields
}

Graph is a directed graph that can contain cycles. It is a wrapper around gonum's graph.Directed interface.

func CreateGraph

func CreateGraph(connections []*Connection) *Graph

func (*Graph) AllPredecessorsOf added in v0.1.0

func (g *Graph) AllPredecessorsOf(component string) []string

AllPredecessorsOf returns all predecessors of a component. Including indirect ones.

func (*Graph) AllSuccessorsOf added in v0.1.0

func (g *Graph) AllSuccessorsOf(component string) []string

AllSuccessorsOf returns all successors of a component. Including indirect ones.

func (*Graph) ComponentToId

func (g *Graph) ComponentToId(name string) int64

func (*Graph) ComponentToNode

func (g *Graph) ComponentToNode(name string) graph.Node

func (*Graph) DirectPredecessorsOf added in v0.1.0

func (g *Graph) DirectPredecessorsOf(component string) []string

DirectPredecessorsOf returns the direct predecessors of a component.

func (*Graph) DirectSuccessorOf added in v0.1.0

func (g *Graph) DirectSuccessorOf(component string) []string

DirectSuccessorOf returns the direct successors of a component.

func (*Graph) Edge

func (g *Graph) Edge(xid, yid int64) graph.Edge

func (*Graph) From

func (g *Graph) From(id int64) graph.Nodes

func (*Graph) HasEdgeBetween

func (g *Graph) HasEdgeBetween(xid, yid int64) bool

func (*Graph) HasEdgeFromTo

func (g *Graph) HasEdgeFromTo(xid, yid int64) bool

func (*Graph) IdToComponent

func (g *Graph) IdToComponent(id int64) string

func (*Graph) Node

func (g *Graph) Node(id int64) graph.Node

func (*Graph) Nodes

func (g *Graph) Nodes() graph.Nodes

func (*Graph) ShortestCycles added in v0.1.0

func (g *Graph) ShortestCycles() map[string]Cycle

ShortestCycles returns a map of the shortest cycles in the graph. Implements: https://link.springer.com/chapter/10.1007/978-3-642-21952-8_19

func (*Graph) StronglyConnectedComponents added in v0.1.0

func (g *Graph) StronglyConnectedComponents() [][]string

StronglyConnectedComponents returns a map of the strongly connected components in the graph. Implements: https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm

func (*Graph) To

func (g *Graph) To(id int64) graph.Nodes

Jump to

Keyboard shortcuts

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