Relationship direction records how a graph relationship points from its start node to its end node. Whether that direction carries meaning depends on the relationship, so schema diagrams may require careful interpretation. section 2.3.4
Graph projection can preserve, reverse, or disregard stored relationship orientation:
- NATURAL projects each relationship as stored in the database. section 7.2.2
- REVERSE projects each relationship in the opposite direction. section 7.2.2
- UNDIRECTED projects both natural and reverse orientations; the engine duplicates the relationship in the opposite direction. section 7.2.2
Reverse HAS_TAG relationships for similarity analysis
A hashtag co-occurrence task projects Tweet and Tag nodes while reversing HAS_TAG relationships. The projected relationship is exposed under the REVERSED_HAS_TAG alias, allowing node similarity to compare hashtags through their associated tweets. section 7.2.2
Listing 7.10 Configuration map to describe the relationship type and its orientation
{ALIAS_OF_TYPE: {type:'RELATIONSHIP_TYPE',
orientation: 'NATURAL',
properties:['property1','property2']}
Inspect the configuration-map structure for naming a projected relationship, selecting its stored type, choosing orientation, and optionally selecting properties. section 7.2.2
Listing 7.11 Projects Tweet and Tag nodes and includes reversed HAS_TAG relationships
CALL gds.graph.project(
'tags', #1
['Tweet', 'Tag'], #2
{REVERSED_HAS_TAG: {orientation:'REVERSE', type:'HAS_TAG'}}); #3
Inspect an executable projection that includes Tweet and Tag nodes and reverses HAS_TAG relationships. section 7.2.2
