Repository: tinkerpop Updated Branches: refs/heads/TINKERPOP-1967 c2a90f6f5 -> 627b6e95b
TINKERPOP-1967 Added a component field to the ConnectedComponent class In this way the user can access the default more readily and is available in GLVs Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/627b6e95 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/627b6e95 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/627b6e95 Branch: refs/heads/TINKERPOP-1967 Commit: 627b6e95b24130dea5582903add52c06b7b64a41 Parents: c2a90f6 Author: Stephen Mallette <[email protected]> Authored: Mon Jul 30 08:29:13 2018 -0400 Committer: Stephen Mallette <[email protected]> Committed: Mon Jul 30 08:29:13 2018 -0400 ---------------------------------------------------------------------- docs/src/recipes/connected-components.asciidoc | 5 ++++- .../computer/traversal/step/map/ConnectedComponent.java | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/627b6e95/docs/src/recipes/connected-components.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/recipes/connected-components.asciidoc b/docs/src/recipes/connected-components.asciidoc index e6d0f7a..c46180f 100644 --- a/docs/src/recipes/connected-components.asciidoc +++ b/docs/src/recipes/connected-components.asciidoc @@ -64,10 +64,13 @@ The traversal looks like: [gremlin-groovy,existing] ---- g.withComputer().V().connectedComponent(). - group().by('gremlin.connectedComponentVertexProgram.component'). + group().by(component). select(values).unfold() ---- +NOTE: The `component` option passed to `by()` is statically imported from `ConnectedComponent` and refers to the +default property key within which the result of the algorithm is stored. + A straightforward way to detect the various subgraphs with an OLTP traversal is to do this: [gremlin-groovy,existing] http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/627b6e95/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ConnectedComponent.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ConnectedComponent.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ConnectedComponent.java index 85558bc..a2223d8 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ConnectedComponent.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/step/map/ConnectedComponent.java @@ -18,6 +18,7 @@ */ package org.apache.tinkerpop.gremlin.process.computer.traversal.step.map; +import org.apache.tinkerpop.gremlin.process.computer.clustering.connected.ConnectedComponentVertexProgram; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -26,6 +27,12 @@ import org.apache.tinkerpop.gremlin.structure.Graph; * {@link GraphTraversal#connectedComponent()} ()}. */ public class ConnectedComponent { + + /** + * The default property key name that will hold the result of the algorithm. + */ + public static final String component = ConnectedComponentVertexProgram.COMPONENT; + /** * Configures the edge to traverse when calculating the pagerank. */
