On Sun, Nov 22, 2009 at 3:35 PM, Tobias Ivarsson <[email protected]> wrote: > Hi, > > You can store properties on Relationships, just as you can on nodes. > Where in the documentation does it say that you cannot do that? Because > that is just plain wrong, it's always been possible. If documentation > somewhere says that it isn't, that needs to be corrected with top priority.
Because i didn't saw it in method summary of : http://api.neo4j.org/current/org/neo4j/api/core/Relationship.html But it was, in fact, written in the very first sentance of the page : A relationship between two nodes in the graph. A relationship has a start node, an end node and a type. You can attach properties to relationships with the API specified in PropertyContainer. > Or do I completely misunderstand your question? Nope, you're correct :) > Storing the Markov chain in Neo4j is not a problem[1], the problem you get > into (that I think you've identified) is with *using* the Markov chain. What > you want to do is choose a branch based on the probability that the word on > the destination node follows the word in the source node. You could do this > either by storing the links in a list with the number of occurrences of a > link corresponding to it's probability or something "smarter". While you can > have multiple relationships (of the same or different types) between the > same two nodes in Neo4j, this gets you into problem since traversing the > relationships is a linear operation, and you are only after One relationship > (but chosen at random). What I did was to store the total number of *virtual > * outgoing links on the source node and then the count of the number of > occurrences stored on each relationship. I would use the number at the start > node to generate a random number, then iterate through the relationships > increasing a counter by the weight of that relationship in each step until > that counter was greater than or equal to the random number I had generated, > I would then return that relationship. I'm planning to count the occurence of a specific word being followed by each other linked words, including itself. (eg : this is super super super cool !) the sum of thoses occurences should be exactly equal to the number of times this word appeared in the "learning text". I normalize thoses occurence (to get a total probability of 1) at runtime (not when populating the database). The problem is "when to stop" the text generation ? I will also create node for punctation. including all "final punctuation" : . ? ! ... When i generate the text i decide : i want n sentence. and stop generation when i traversed any final punctuation n times :) i haven't started to code yet. i'll problably see new problems i can't imagine yet. > Just my 2c, since I've worked on a similar problem before ;) thank you. -- Laurent "ker2x" Laborde Sysadmin & DBA at http://www.over-blog.com/ _______________________________________________ Neo mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

