Finding Vertices
Daniel has posted the set of three queries to find vertices of a given quality.
FIXME They don't seem to work in TP3.
Graph
gremlin> g = new TinkerGraph()
==>tinkergraph[vertices:0 edges:0]
gremlin> v1 = g.addVertex(id, 1).next()
==>v[1]
gremlin> v2 = g.addVertex(id, 2).next()
==>v[2]
gremlin> v3 = g.addVertex(id, 3).next()
==>v[3]
gremlin> v4 = g.addVertex(id, 4).next()
==>v[4]
gremlin> v5 = g.addVertex(id, 5).next()
==>v[5]
gremlin> v7 = g.addVertex(id, 7).next()
==>v[7]
gremlin> v1.addEdge("a", v2)
==>e[0][1-a->2]
gremlin> v3.addEdge("a", v2)
==>e[1][3-a->2]
gremlin> v4.addEdge("a", v5)
==>e[2][4-a->5]
gremlin> v7.addEdge("a", v4)
==>e[3][7-a->4]
Find vertices with only incoming edges
g.V().filter { !it.outE().hasNext() }
Find vertices with only outgoing edges
g.V().filter { !it.inE().hasNext() }
Find vertices with at most 1 edge on any side
g.V().filter { it.bothE().count() == 1 }