Skip to content

Commit

Permalink
fixup: refactor of the topology functions
Browse files Browse the repository at this point in the history
  • Loading branch information
guicassolato committed Jul 15, 2024
1 parent b72f969 commit d145833
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions machinery/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (c *collection[T]) Roots() []T {
}

// Parents returns all parents of a given item in the collection.
func (c *collection[T]) Parents(item T) []T {
func (c *collection[T]) Parents(item Object) []T {
var parents []T
n, err := c.topology.graph.Node(item.GetURL())
if err != nil {
Expand All @@ -285,7 +285,7 @@ func (c *collection[T]) Parents(item T) []T {
}

// Children returns all children of a given item in the collection.
func (c *collection[T]) Children(item T) []T {
func (c *collection[T]) Children(item Object) []T {
var children []T
n, err := c.topology.graph.Node(item.GetURL())
if err != nil {
Expand All @@ -307,7 +307,7 @@ func (c *collection[T]) Children(item T) []T {

// Paths returns all paths from a source item to a destination item in the collection.
// The order of the elements in the inner slices represents a path from the source to the destination.
func (c *collection[T]) Paths(from, to T) [][]T {
func (c *collection[T]) Paths(from, to Object) [][]T {
if &from == nil || &to == nil {
return nil
}
Expand All @@ -319,7 +319,7 @@ func (c *collection[T]) Paths(from, to T) [][]T {
}

// dfs performs a depth-first search to find all paths from a source item to a destination item in the collection.
func (c *collection[T]) dfs(current, to T, path []T, paths *[][]T, visited map[string]bool) {
func (c *collection[T]) dfs(current, to Object, path []T, paths *[][]T, visited map[string]bool) {
currentURL := current.GetURL()
if visited[currentURL] {
return
Expand Down

0 comments on commit d145833

Please sign in to comment.