Yes, you can add a predicate to ensure that all relationships in the path have the same property value.
This helps to find out all the possible busLineID values by first discovering the common values in the relationships extending from both nodes.
MATCH (p1:BusStop {idStop: "1293"})-[r:PATH]-()
WITH p1, COLLECT(DISTINCT r.busLineID) as firstSet
MATCH (p2:BusStop {idStop: "1052"})-[r:PATH]-()
WITH p1, p2, firstSet, COLLECT(DISTINCT r.busLineID) as secondSet
WITH p1, p2, FILTER(id IN firstSet WHERE id IN secondSet) as commonIDs
UNWIND commonIDs as busLineID
MATCH path = shortestpath((p1)-[:PATH*]-(p2))
WHERE ALL(rel in RELATIONSHIPS(path) | rel.busLineID = busLineID)
RETURN path
, WHERE ALL shortestPath() , .
, , , , .
- . , , . ( , ):
MATCH (p1:BusStop {idStop: "1293"}), (p2:BusStop {idStop: "1052"})
MATCH p = allShortestPaths((p1)-[:PATH*]-(p2))
RETURN p, SIZE(FILTER(x in RANGE(0, SIZE(RELATIONSHIPS(p)))
WHERE (RELATIONSHIPS(p)[x]).busLineID <> (RELATIONSHIPS(p)[x-1]).busLineID)) as busLineChanges
ORDER BY busLineChanges ASC
, , , shortestPath() , , , , busLineID MATCH, WHERE, WITH RETURN, shortestPath() (shortestPath() MATCH WHERE , , , shortestPath()).
, .
, , , : PATH ( , , , ):
MATCH (p1:BusStop {idStop: "1293"}), (p2:BusStop {idStop: "1052"})
MATCH path = (p1)-[rels:PATH*1..10]-(p2)
WITH path, SIZE(FILTER(x in RANGE(0, SIZE(rels))
WHERE (rels[x]).busLineID <> (rels[x-1]).busLineID)) as busLineChanges
WHERE busLineChanges <= 3
RETURN path, busLineChanges
ORDER BY SIZE(path) ASC
LIMIT 1
: PATH, , .