Hi again, Any ideas or input to simplify the problem? Would be possible to halt the traverseal until a specific threshold has been reached ?
I haven't tried all possible functions, maybe something with a FOREACH and then a CASE scenario would evaluate each traversal and return the result upon satisfying the threshold ? Thanks Den onsdagen den 26:e mars 2014 kl. 12:22:54 UTC+1 skrev Lundin: > > Hello! > > I have already posted a similar thing on stackoverflow and i mean in no > way to cross-post the actual problem (which is all made up btw) but rather > understand why a graph algorithm couldnt be useful when solving certain > problems > > http://stackoverflow.com/questions/22646305/is-there-anything-like-a-do-while-match-pattern-that-satisfy-an-aggregated-val > > So, i posted that before i even knew there was something called knapsack > problem: > http://rosettacode.org/wiki/Knapsack_problem/0-1 > > where a problem is forumlated as > *Which items does the tourist carry in his knapsack so that their total > weight does not exceed 400 dag [4 kg], and their total value is maximised?* > I think this question combined with a graph pattern is useful becuase the > traversal is actually taking place so the cost could be calculated. > > And in many ways this is much similar to what i am trying to understand > how graph query can be used or am i wrong on this ? Should it be on > application level only? > > What i eventually would like to do is to test the reduce/accumulator > function or limit not only on rows but on actual property values if that > make sense. > > Assume we have a graph with people and page nodes. The page nodes have > stats on them. This query accumulates the stats for the pages a person has > visited > > MATCH (n:People)-[:VISITS]-sites WITH reduce(acc=0, x IN collect(sites. > dailyhits)| acc + x) AS totalhits RETURN totalhits; > > > I thinks an expression like this could be useful to limit the pattern: > > MATCH (n:People)-[:VISITS]-sites WITH reduce(acc=0, x IN collect(sites. > dailyhits)| acc + x) AS totalhits WHERE totalhits<50000 RETURN totalhits; > > I understand why it doesnt work, but the idea of evaluate an expression > for each graph traverse or compare paths seems to be a very useful way of > getting a more appropriate resultsets for some problems. > > Any inputs or general ideas ? > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
