[Neo] indexing relationships

Tobias Ivarsson tobias.ivarsson at neotechnology.com
Tue Jul 7 09:37:07 CEST 2009


Was that what you meant?

My interpretation of Symeons request was an index from
(RelationshipType,Node,Node) to Relationship, which in my opinion would be
much more useful than a simple index from (String,primitive) to
Relationship, which is how the node indexes work.

The use for such an index would be for places where you have many
relationships from a node and quickly wish to determine if there is a
relationship from that node to a given node.

The benefit of having this be part of index-util (as opposed to internally
in neo-core) is obvious. Keeping an index like this updated is expensive.
You as an application developer know where in your graph you need it and
thus where you are prepared to pay the extra overhead for insertion (an
overhead that pays back on lookup). If we instead were to add something like
this to neo-core we would add that overhead to all relationship creations,
and that would be very undesirable.


To further clarify the distinction between an index like this and the
currently existing indexes, here is a quick definition of the interface for
it:

interface RelationshipIndex {
    void index(Relationship relationship);
    Relationship lookup(RelationshipType type, Node start, Node end);
    void remove(Relationship relationship);
}

Cheers,
Tobias

On Mon, Jul 6, 2009 at 7:27 PM, Peter Neubauer <neubauer.peter at gmail.com>wrote:

> Hi Symeon,
> so, what you are saying is that you would like to have the possibility
> to set indexes on relationships and their properties just like on the
> nodes as in http://components.neo4j.org/index-util/ ?
>
> I guess that would be easy to do, or you could do it yourself by
> looking at the index-util package, but I guess being able to treat
> Relationships as first-class indexing citizens is a good idea ... any
> others that have opinions on that?
>
> /peter
>
> GTalk:      neubauer.peter
> Skype       peter.neubauer
> Phone       +46 704 106975
> LinkedIn   http://www.linkedin.com/in/neubauer
> Twitter      http://twitter.com/peterneubauer
>
> http://www.neo4j.org     - New Energy for Data - The Graph Database.
> http://www.ops4j.org     - New Energy for OSS Communities - Open
> Participation Software.
> http://www.oredev.org   - Where Good Geeks Grok.
>
>
>
> On Mon, Jul 6, 2009 at 10:38 AM, Symeon (Akis)
> Papadopoulos<papadop at iti.gr> wrote:
> > Hi,
> >
> > I have been experimenting with incremental building of large graphs and
> > I realized that the graph update process would be much faster if there
> > was a possibility to index relationships between pairs of nodes in order
> > to have the possibility for quick lookups. Currently, each time I want
> > to create or update a relationship between two nodes (say n1 and n2), I
> > first need to iterate through all relationships (of the particular type)
> > of n1 and check whether the other node is n2. Is there any effort within
> > neo4j.util.index to provide such functionality or should I try to
> > develop something on my own?
> >
> > Best regards,
> > Symeon (Akis)
> > _______________________________________________
> > Neo mailing list
> > User at lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Tobias Ivarsson <tobias.ivarsson at neotechnology.com>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857


More information about the User mailing list