I presume you care about the presence/absence of the Labels and not the extra movie title RETURN in A vs. B
Here, the PROFILE command will answer your question
A)
PROFILE MATCH(tom:Person{name:"Tom Hanks"})-[:ACTED_IN]->(mov:Movie)<-[:ACTED_IN]-(co:Person)
RETURN co.name // ,mov.title // removed
shows 265 total db hits in 120 ms the first time the query is run after restarting the DB.
B)
PROFILE MATCH (tom:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(coActors) RETURN coActors.name
shows 214 total db hits in 82 ms the first time the query is run after restarting the DB
The profile pictures shows why (A on the left, B on the right.) The query with the extra Labels (Movie
and Person
for co actors) have two extra Filter statements, which in the Movie DB are unneeded because ACTED_IN relationship always starts with a Person and ends with a Movie. That might not be true in general.
I will note that having the extra Labels helps a person understand the query better.
I do wonder if this is an opportunity for optimization: could Neo4J keep track of the Labels associated with a Relationships, and not bother to filter if there is only one type of Label for either the in or out of the relationship.