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 ab1d3bc027 Make the betweeness centrality recipe self-contained
ab1d3bc027 is described below
commit ab1d3bc027ab684f8733f7cf9531d876813345bd
Author: Stephen Mallette <[email protected]>
AuthorDate: Fri Sep 25 19:56:49 2026 +0000
Make the betweeness centrality recipe self-contained
The betweeness centrality example jumped straight into an addV() chain
without first establishing a graph or traversal source, so a reader
copying only this section had no defined g before the traversal ran.
The neighboring centrality examples get g from the modern toy graph, but
this one builds its own small graph and needs an empty one to start.
Add the standard graph = TinkerGraph.open() and g = traversal().with(graph)
setup lines, matching the pattern used elsewhere in the docs, so the
example runs as written when copied on its own.
Assisted-by: Kiro:claude-opus-4.8
---
docs/src/recipes/centrality.asciidoc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/docs/src/recipes/centrality.asciidoc
b/docs/src/recipes/centrality.asciidoc
index ce1a760558..bc5386e4b6 100644
--- a/docs/src/recipes/centrality.asciidoc
+++ b/docs/src/recipes/centrality.asciidoc
@@ -65,8 +65,10 @@ graph for demonstration purposes:
image:betweeness-example.png[width=600]
-[gremlin-groovy ]
+[gremlin-groovy]
----
+graph = TinkerGraph.open()
+g = traversal().with(graph)
g.addV().property(id,'A').as('a').
addV().property(id,'B').as('b').
addV().property(id,'C').as('c').