[Neo] Popularity sorting
Craig Taverner
craig at amanzi.com
Wed Feb 10 13:27:36 CET 2010
I understand that the problem is not how to store this, and the hash is a
solution to that, but how to measure 'popularity' if you don't get the same
node as many times as it was bought (due to traverser only returning each
node once). I think the solution can be as simple as:
- have the traverser return the list of nodes for products bought by
people that bought X (as before)
- count popularity on each product as the count of incoming 'bought'
relationships (so don't need to do this as part of the traverser)
Of course, it might also be a nice convenience if the traverser, in it's
duplicate detection code also kept a counter, and this could be requested
afterwards.
On Wed, Feb 10, 2010 at 1:10 PM, <rick.bullotta at burningskysoftware.com>wrote:
> 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 <cowen at thoughtworks.com>
> Date: Wed, February 10, 2010 3:05 am
> To: user at 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
> cowen at thoughtworks.com
> Mobile: 07886711645
> IM: chris.jowen
> Twitter: chrisjowen
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> [1]https://lists.neo4j.org/mailman/listinfo/user
>
> References
>
> 1. https://lists.neo4j.org/mailman/listinfo/user
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
More information about the User
mailing list