This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/master by this push:
new 9b8937694b Add runnable example to ConnectedComponentVertexProgram docs
9b8937694b is described below
commit 9b8937694bddd0ffc652142fb9123604c70134c0
Author: Stephen Mallette <[email protected]>
AuthorDate: Thu Sep 10 12:23:18 2026 +0000
Add runnable example to ConnectedComponentVertexProgram docs
The ConnectedComponentVertexProgram reference subsection was a two-sentence
stub, while its PageRank, PeerPressure, and ShortestPath siblings each
carry a
runnable example. Expand it to match: add a [gremlin-groovy,modern] block
that
builds the program, submits it, and reads the per-vertex component
assignment,
plus a Builder configuration table and a note on the default component
property
key.
Assisted-by: Kiro:claude-opus-4.8
---
docs/src/reference/the-graphcomputer.asciidoc | 31 ++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/docs/src/reference/the-graphcomputer.asciidoc
b/docs/src/reference/the-graphcomputer.asciidoc
index 05c364b3cb..95f5804b87 100644
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@ -418,7 +418,36 @@ g.V().peerPressure().
=== ConnectedComponentVertexProgram
The `ConnectedComponentVertexProgram` identifies
link:https://en.wikipedia.org/wiki/Connected_component_(graph_theory)[Connected
Component]
-instances in a graph. See
<<connectedcomponent-step,`connectedComponent()`>>-step for more information.
+instances in a graph. Each vertex is assigned a component identifier, which is
the lexicographically smallest string form of a
+vertex id among all vertices that are reachable from it. Vertices that share
the same identifier belong to the same connected
+component. By default the identifier is stored on each vertex under the
`gremlin.connectedComponentVertexProgram.component` property,
+which is also exposed as the `ConnectedComponentVertexProgram.COMPONENT`
constant.
+
+[gremlin-groovy,modern]
+----
+ccvp = ConnectedComponentVertexProgram.build().create() <1>
+result = graph.compute().program(ccvp).submit().get() <2>
+g = traversal().with(result.graph()) <3>
+g.V().valueMap('name', ConnectedComponentVertexProgram.COMPONENT) <4>
+g.V().groupCount().by(ConnectedComponentVertexProgram.COMPONENT) <5>
+----
+
+<1> Create a `ConnectedComponentVertexProgram` with its default configuration.
+<2> Execute the `ConnectedComponentVertexProgram`.
+<3> Create a traversal source over the resulting graph, which now carries the
component assignments.
+<4> Read the component identifier assigned to each vertex. Every vertex in the
"modern" graph is reachable from every other, so they all share a single
component.
+<5> Count the vertices in each component, confirming that the "modern" graph
forms one connected component.
+
+The `ConnectedComponentVertexProgram.Builder` provides the following
configuration methods:
+
+[width="100%",cols="3,15,5",options="header"]
+|=========================================================
+| Method | Description | Default
+| `property(String)` | Sets the vertex property that stores the component
identifier. | `gremlin.connectedComponentVertexProgram.component`
+| `edges(Traversal)` | Sets a traversal that emits the edges to traverse when
determining connectivity. | `__.bothE()`
+|=========================================================
+
+Note that `GraphTraversal` provides a
<<connectedcomponent-step,`connectedComponent()`>>-step.
[[shortestpathvertexprogram]]
=== ShortestPathVertexProgram