|
|
@ -6,6 +6,8 @@ import ( |
|
|
|
"gopkg.in/mgo.v2/bson" |
|
|
|
) |
|
|
|
|
|
|
|
var upLevelEdge EdgeModel |
|
|
|
|
|
|
|
func upTree(address string, network NetworkModel) NetworkModel { |
|
|
|
var upNetwork NetworkModel |
|
|
|
|
|
|
@ -31,9 +33,16 @@ func upTree(address string, network NetworkModel) NetworkModel { |
|
|
|
err := nodeCollection.Find(bson.M{"id": }).All(&edges) |
|
|
|
check(err) |
|
|
|
*/ |
|
|
|
edgeUpCheck := EdgeModel{} |
|
|
|
err := edgeCollection.Find(bson.M{"to": e.From}).One(&edgeUpCheck) |
|
|
|
check(err) |
|
|
|
|
|
|
|
//need to be fixed when there is a bucle between the addresses (A-->B, B-->C, C-->A)
|
|
|
|
fmt.Println(e.From + " - " + e.To) |
|
|
|
if e.From != e.To { |
|
|
|
//if e.From != e.To && e.From != upLevelEdge.To && e.To != upLevelEdge.From {
|
|
|
|
//if e.From != e.To {
|
|
|
|
if edgeInEdges(network.Edges, edgeUpCheck) == false { |
|
|
|
upLevelEdge = e |
|
|
|
upNetwork = upTree(e.From, network) |
|
|
|
for _, upN := range upNetwork.Nodes { |
|
|
|
if nodeInNodes(network.Nodes, upN) == false { |
|
|
|