

Graph queries can go much longer than a single step. If the path ->likes->person goes from a person record to another person record, then the path ->likes->person->likes->person will go one more step down. The result will be the people that are liked by someone that is liked by another.
Here is a quick example of this from the X-Men franchise, in which the character Wolverine likes Jean Grey, who likes the superhero Cyclops. Here, the hero:wolverine->likes->hero path leads to Jean Grey, the person he likes, but the hero:wolverine->likes->hero->likes->hero path to Cyclops, who he hates! (Well, sort of hates. It's complicated.)
For our person records, just repeating ->works_at->place would make no sense, because libraries don't work at libraries.
But the arrows can be turned around at the midpoint to form this path instead.
This path starts with a person down the ->works_at->place path to see where the person works. Once it reaches the place, it then follows the <-works_at<- path to see the people that are employed by the library. Finally, it uses .name to access their name field.
Queries can be written over multiple lines, so breaking these paths down with comments on each line can be helpful when you need to come back and read your own code later.
The end result: all the people that work at a library that the first person works at.
Now let's improve the output a bit by having the team_members contain every name except the name of the current person.
Since a graph path returns an array, that lets us use any of SurrealDB's array functions on it. One of them is called array::complement() and returns every item in one array minus the items in a second array.
We can use that at the ->works_at->place<-works_at<-person path to return every person's name, minus the current person.
Now the output shows each person's teammates, without including the person's name as well.