Notes: If you see US in the code, that's a quick kotlinization of the __ groovy dsl, which doesn't play nicely with IntelliJ.
Part 2
Ok, now that I had a method for stepping through the graph, it was much easier to add resources and have time get updated in the DB as I traversed and deleted nodes.
At least, it would have been if I remembered how to gremlin. I spent more time than I'm willing to admit relearning my group() and order() semantics. Then I spent some time trying to make sure that my traversal prioritized items that were already started, as the sample gave different answers if your workers changed steps willy-nilly.
Post-submission optimization: you can just step down the minimum time of the nodes being worked on instead of 1.
KotlinTinkerPop/Gremlin SolutionPart 1
I feel really bad, but I kept banging my head on graph walking, so I gave up and pulled in a graph database to handle that for me.
My first solution was just stepping through
g.V().not(inE()).order().by(property("name").value()).limit(1)
and then dropping each one.However, here's what a real property graph database solution would look like:
Notes: If you see
US
in the code, that's a quick kotlinization of the__
groovy dsl, which doesn't play nicely with IntelliJ.Part 2
Ok, now that I had a method for stepping through the graph, it was much easier to add resources and have time get updated in the DB as I traversed and deleted nodes.
At least, it would have been if I remembered how to gremlin. I spent more time than I'm willing to admit relearning my
group()
andorder()
semantics. Then I spent some time trying to make sure that my traversal prioritized items that were already started, as the sample gave different answers if your workers changed steps willy-nilly.Post-submission optimization: you can just step down the minimum time of the nodes being worked on instead of 1.