func findEdgeConnections(g *graph.Graph, n *graph.Node, visited map[string]struct{}, opt Options) ([][][]*connection, error) {
	res := make([][][]*connection, 0)
	edges := g.GetEdgesForNode(n.ID)
	for _, e := range edges {
		if _, ok := visited[e.ID]; ok {
			continue
		}
		en, err := g.GetNodeByID(e.Source)
		direc := negative
		if e.Source == n.ID {
			en, err = g.GetNodeByID(e.Target)
			direc = positive
		}
		if err != nil {
			return nil, err
		}
		pv, rs, err := getProviderAndResource(en.Canonical, opt)
		if err != nil {
			return nil, err
		}
		if pv.Type() == provider.IM {
			continue
		}
		visited[e.ID] = struct{}{}
		if pv.IsNode(rs) {
			res = append(res, [][]*connection{
				{
					&connection{
						Node:      en,
						Direction: direc,
					},
				},
			})
		} else {
			aux := make(map[string]struct{})
			for k, v := range visited {
				aux[k] = v
			}
			cons, err := getShortestNodePath(g, en, aux, opt)
			if err != nil {
				return nil, err
			}
			if len(cons) != 0 {
				for i, cs := range cons {
					con := []*connection{
						&connection{
							Node:      en,
							Direction: direc,
						},
					}
					cons[i] = append(con, cs...)
				}
				res = append(res, cons)
			}
		}
	}
	return res, nil
}
findEdgeConnections for each edge on n returns the closests connections to a Node.
The last 'connection' on the []*connection will be a valid provider Node.
If there are more than one short path they will also be returend
The [][][]*connection is:
* First [] is for each edge of the n
* Second [] is for the shortest connections
* Third [] is for the connections building a shortest path to another Node
package generate
import (
	"github.com/cycloidio/inframap/graph"
	"github.com/cycloidio/inframap/provider"
)
type direction int
const (
	positive direction = 1
	negative direction = -1
)
type connection struct {
	Node *graph.Node
	Direction direction
}