Hi,
To get the keys (vertices), simply do:
...groupCount().cap().next().sort{a,b -> b.value <=> a.value}[0..9].scatter.transform{it.key}
1. scatter will "unroll" your map into its entries (assuming, I believe Gremlin 1.5+)
2. transform will then emit the key of the entry, thus, separating the key from its entry value.
If you don't want it as a one line, you can do:
m = ...groupCount().cap().next().sort{a,b -> b.value <=> a.value}[0..9]
m.each { k, v ->
// do what you want with each key and value
}
HTH,
Marko.