Logger.info("Comparing: " + x + " and " + y)
x.label.asInstanceOf[StoryTransition].weight.compareTo(y.label.asInstanceOf[StoryTransition].weight)
}
startNode.withOrdering(eo).withSubgraph(edges =...
graph.get(state).withOrdering(eo).withSubgraph(edges = ...where eo is defined as:
def eo = graph.EdgeOrdering.apply{(x, y) => x.label.asInstanceOf[StoryTransition].weight.compareTo(y.label.asInstanceOf[StoryTransition].weight)}
By default here we are working with InnerNodeTraverser.
Is my EdgeOrdering defined properly?
Bruno
OK, I made a self executing sample. Only thing needed to run it is “sbt run”.
Here’s quick background:
This works as expected and gives traversal result S1, S4, S6.
However, order of traversal during first branching is: S1-S2, S1-S5, S1-S4, S1-S3 which is I guess expected because edges have been supplied in that order, but in my production application varies randomly (I have big network of edges).
If I uncomment line 22 in MyGraph.scala to enable ordering, nothing changes and that is the source of problem. Ordering should be done by weight attribute included in label object on edges.
(1 to 16).toSet
import scala.collection.mutable.Set
Set.empty[Int] ++ (1 to 6)
Set.empty[Int] ++ (1 to 20)