I have a graph with no cycles. Each vertex has a label. For those with a specific label, call it "A", I want to count
- how many nodes with label "A" are not connected to any other nodes with label "A"
- how many are connected in a chain of length 2: (A) > (A)
- how many are connected in a chain of length 3: (A) > (A) > (A)
- and so on, up to the longest such path.
I only need to follow out edges.
I have brute forced something related with a set of queries (below) but I want to generalize into one query and not count longer paths with the shorter paths.
g.V().has('label','A').outE().inV().has('label', 'A').count()
g.V().has('label','A').outE().inV().has('label', 'A').outE().inV().has('label', 'segment').count()
g.V().has('label','A').outE().inV().has('label', 'A').outE().inV().has('label', 'A').outE().inV().has('label', 'A').count()
Thanks