Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why run IterativeConnectedComponents is similar to the death cycle #35

Closed
lilicao701 opened this issue May 9, 2017 · 2 comments
Closed

Comments

@lilicao701
Copy link

Hi,
I try to run IterativeConnectedComponents with socketStream, when input of: 1,3 1,4,,1,5 the result is OK, when input "5,6", the result print so many "6,1":
(1,1)
(3,1)
(4,1)
(4,1)
(4,1)
(4,1)
(4,1)
(4,1)
(4,1)
(4,1)
(4,1)
(4,1)
(4,4)
(5,4)
(4,1)
(5,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)
(6,1)

Process finished with exit code -1
could you tell me how to run this algorithm? thank you very much.

@vasia
Copy link
Owner

vasia commented May 9, 2017

Hi @lilicao701,
this algorithm is simply a proof of concept and not the recommended way to run connected components. We are working on adding proper iterations in gelly-stream soon. Until then, I would suggest you use the single-pass connected components algorithm.

@vasia vasia closed this as completed May 9, 2017
@lilicao701
Copy link
Author

Hi,
I fixed this bug, about the function of "addToExistingComponent" , the vertices.add(toAdd); is not right.
The right code is like this:

private void addToExistingComponent(long componentId, long toAdd, Collector<Tuple2<Long, Long>> out) {
		HashSet<Long> vertices = components.remove(componentId);
        vertices.add(toAdd);
        //System.out.println("************addToExistingComponent componentId=" + componentId + ",toAdd = " + toAdd);
		if (componentId >= toAdd) {
			// output and update component ID
			for (long v: vertices) {
				out.collect(new Tuple2<Long, Long>(v, toAdd));
			}

			components.put(toAdd, vertices);
		}
		else {
			components.put(componentId, vertices);
			out.collect(new Tuple2<Long, Long>(toAdd, componentId));

		}
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants