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.

Or do I completely misunderstand your question?

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.

Just my 2c, since I've worked on a similar problem before ;)


Moving on to answering Oliver Rossels question about reification: No.
Reification of relationships is not possible in Neo4j, this would induce a
penalty in performance and isn't something you need in that many cases,
which is why we have opted to not support it. You can however emulate it by
introducing an intermediate node that you can draw the reificating
relationship from, like so:

NODE_ONE --REL_PART_ONE--> INTERMEDIATE --REL_PART_TWO--> NODE_TWO

Where the two relationships could have either the same type, or different
types depending on how your model is structured. The performance from this
would be pretty good actually since the INTERMEDIATE node would only have
one incoming relationship of it's main relationship type and one outgoing.

This is what we do in the RDF layers on top of Neo4j.

Happy Hacking,

/Tobias

[1] I've done similar toy examples for a web site I made that is a parody on
Swedish news sites and generate fake "news" with the same word probability
as Swedish news, by using the feeds from these news sites as training for a
Markov chain.

-- 
Tobias Ivarsson <[email protected]>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to