Github user dkuppitz commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/897#discussion_r205981525 --- Diff: docs/src/recipes/connected-components.asciidoc --- @@ -35,46 +54,92 @@ g.addV().property(id, "A").as("a"). addE("link").from("d").to("e").iterate() ---- -One way to detect the various subgraphs would be to do something like this: +==== Small graph traversals +Connected components in a small graph can be determined with either an OLTP traversal or the OLAP +`connectedComponent()`-step. The `connectedComponent()`-step is available as of TinkerPop 3.4.0 and is +described in more detail in the +link:http://tinkerpop.apache.org/docs/x.y.z/reference/#connectedcomponent-step[Reference Documentation]. +The traversal looks like: [gremlin-groovy,existing] ---- -g.V().emit(cyclicPath().or().not(both())).repeat(both()).until(cyclicPath()). <1> - path().aggregate("p"). <2> - unfold().dedup(). <3> - map(__.as("v").select("p").unfold(). <4> - filter(unfold().where(eq("v"))). - unfold().dedup().order().by(id).fold()). - dedup() <5> +g.withComputer().V().connectedComponent(). + group().by('gremlin.connectedComponentVertexProgram.component'). --- End diff -- I think you should use the constant `ConnectedComponentVertexProgram.COMPONENT`.
---