Re: [Neo4j] Question about labelling all connected components

2010-07-24 Thread Mattias Persson
2010/7/23 Arijit Mukherjee ariji...@gmail.com Thanx to both of you. Yes, I can just check whether the label exists on the node or not. In my case checking for Integer.MIN_VALUE which is what is assigned when the subscriber node is created. To assign a temporary value (or a value representing

Re: [Neo4j] Question about labelling all connected components

2010-07-24 Thread Alex D'Amour
One other option is to have a set of nodes, each of which represents a component. You can create a relationships of type OWNS (or whatever) to each of the nodes of a given component. This makes component lookup rather simple (just grab the node that represents the component, then traverse all of

Re: [Neo4j] Question about labelling all connected components

2010-07-23 Thread Andrew Baine
The union find algorithm would be appropriate for labeling connected components as you build the graph. Andrew Baine On Thursday, July 22, 2010, Arijit Mukherjee ariji...@gmail.com wrote: Thanx to both of you. Yes, I can just check whether the label exists on the node or not. In my case

[Neo4j] Question about labelling all connected components

2010-07-22 Thread Arijit Mukherjee
Hi All I'm trying to label all connected components in a graph - i.e. all nodes that are connected will have a common componentID property set. I'm using the Traverser to do this. For each node in the graph (unless it is already labelled, which I track by inserting the node ID in a list), the

Re: [Neo4j] Question about labelling all connected components

2010-07-22 Thread Tobias Ivarsson
The first obvious thing is that labelled.contains(currentNode.getId()) is going to take more time as your dataset grows, since it's a linear search for the element in an ArrayList. A HashSet would be a much more appropriate data structure for your application. The other thing that comes to mind

Re: [Neo4j] Question about labelling all connected components

2010-07-22 Thread Arijit Mukherjee
Thanx to both of you. Yes, I can just check whether the label exists on the node or not. In my case checking for Integer.MIN_VALUE which is what is assigned when the subscriber node is created. BTW - is it ever possible to label the components while creating the graph? I can't think of any way of