Documentation
¶
Index ¶
- type Connection
- type Cycle
- type Graph
- func (g *Graph) AllPredecessorsOf(component string) []string
- func (g *Graph) AllSuccessorsOf(component string) []string
- func (g *Graph) ComponentToId(name string) int64
- func (g *Graph) ComponentToNode(name string) graph.Node
- func (g *Graph) DirectPredecessorsOf(component string) []string
- func (g *Graph) DirectSuccessorOf(component string) []string
- func (g *Graph) Edge(xid, yid int64) graph.Edge
- func (g *Graph) From(id int64) graph.Nodes
- func (g *Graph) HasEdgeBetween(xid, yid int64) bool
- func (g *Graph) HasEdgeFromTo(xid, yid int64) bool
- func (g *Graph) IdToComponent(id int64) string
- func (g *Graph) NoConnections() bool
- func (g *Graph) Node(id int64) graph.Node
- func (g *Graph) Nodes() graph.Nodes
- func (g *Graph) ShortestCycles() map[string]Cycle
- func (g *Graph) StronglyConnectedComponents() [][]string
- func (g *Graph) To(id int64) graph.Nodes
- type Results
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
Type string
//The file in which the connection is made. The from side.
File string
Begin *file.Position
End *file.Position
}
Connection is a connection (coupling) between two components.
func GetConnectionsFromSnippetImports ¶ added in v0.1.5
func GetConnectionsFromSnippetImports(snippetsByType file.SnippetGroup, snippetsByComponent file.SnippetGroup) []*Connection
func (*Connection) String ¶ added in v0.1.5
func (c *Connection) String() string
type Graph ¶
type Graph struct {
Name string
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(graphName string, includedComponents []string, connectionsUnpurged []*Connection) *Graph
CreateGraph creates a new graph with the given name, included components and connections. The included components automatically include all components in the connections. If you want to include more (orphaned) components, you can add them to the includedComponents slice else pass nil.
func (*Graph) AllPredecessorsOf ¶ added in v0.1.0
AllPredecessorsOf returns all predecessors of a component. Including indirect ones.
func (*Graph) AllSuccessorsOf ¶ added in v0.1.0
AllSuccessorsOf returns all successors of a component. Including indirect ones.
func (*Graph) ComponentToId ¶
func (*Graph) DirectPredecessorsOf ¶ added in v0.1.0
DirectPredecessorsOf returns the direct predecessors of a component.
func (*Graph) DirectSuccessorOf ¶ added in v0.1.0
DirectSuccessorOf returns the direct successors of a component.
func (*Graph) HasEdgeBetween ¶
func (*Graph) HasEdgeFromTo ¶
func (*Graph) IdToComponent ¶
func (*Graph) NoConnections ¶ added in v0.1.5
func (*Graph) ShortestCycles ¶ added in v0.1.0
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
StronglyConnectedComponents returns a map of the strongly connected components in the graph. Implements: https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
type Results ¶ added in v0.1.5
type Results struct {
Connections []*Connection
}