Hi, Chris.
You could implement something as straightforward as a HashMap<String,Integer> that, as you traverse the graph, insert or increment the Product and its "popularity accumulator". Alternatively, what we've generally done for more complex types of queries (sorted, aggregated, complex filters) is to reduce the list of nodes to a manageable set via smart traversals (e.g. other products purchases by customers who have bought product X), and while traversing, create Java objects that correspond to the values needed for the query (along with a reference to the original node). We add these Java objects to an ArrayList, then we wrote a library of classes that allow us to do SQL-like functions on the resultant collection. Rick -------- Original Message -------- Subject: [Neo] Popularity sorting From: Chris Owen <co...@thoughtworks.com> Date: Wed, February 10, 2010 3:05 am To: user@lists.neo4j.org Hi, One of the questions that we were asked to try and answer was: *"based on Product X find other Products Customers bought who also bought Product X". * This is quite simple to traverse, but what we were now trying to answer a very similar question of: *"based on Product X find other Products Customers have bought who also bought Product X and order by Popularity". * We have not managed to find a way without altering the internal traverses of Neo4J to be able to see how many times a node is found as by default it ignores duplicates. Any ideas of how we solve this problem? Cheers, Chris. -- Chris Owen Developer ThoughtWorks UK co...@thoughtworks.com Mobile: 07886711645 IM: chris.jowen Twitter: chrisjowen _______________________________________________ Neo mailing list User@lists.neo4j.org [1]https://lists.neo4j.org/mailman/listinfo/user References 1. https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user