liveBook · Manning

Orientation parameter

As explained in Graph Algorithms for Data Science

An orientation parameter selects whether a directed graph algorithm evaluates outgoing relationships, incoming relationships, or both directions.

An orientation parameter controls which relationship directions a directed graph algorithm evaluates: outgoing, incoming, or both. It changes how node connectivity is counted without changing the graph itself. section 6.2.1

Choose one of three orientation values:

  • NATURAL evaluates out-degree, counting outgoing relationships. section 6.2.1
  • REVERSE evaluates in-degree, counting incoming relationships. section 6.2.1
  • UNDIRECTED evaluates the sum of in-degree and out-degree, treating both directions together. section 6.2.1

Retweet and shared-audience networks

In a retweet amplification network, NATURAL identifies users spreading content and REVERSE identifies users whose content is retweeted. In a shared-audience network, UNDIRECTED makes sense because shared audiences imply a mutual relationship between streams. section 6.2.1 section 9.3.3

Listing 6.6 Returns the top five users with the highest in-degree
CALL gds.degree.stats('amplify', {orientation:'REVERSE'})
YIELD centralityDistribution

Inspect the reverse orientation in a degree-statistics call using orientation:'REVERSE'. section 6.2.1

Listing 9.6 Projecting the in-memory graph of streams and their shared audience in-memory
run_query("""
CALL gds.graph.project("twitch", "Stream",
 {SHARED_AUDIENCE: {orientation: "UNDIRECTED", properties:["weight"]}})
""")

See UNDIRECTED applied during an in-memory graph projection with a relationship weight property. section 9.3.3

How Graph Algorithms for Data Science covers it

How deep it goes
Defines three direction modes and demonstrates their query usage, without discussing algorithm internals or optimization.
Examples
Uses retweet amplification and shared-audience networks to contrast directed analysis with undirected projection.
What it assumes
Assumes a projected graph with relationships whose direction and, optionally, weight properties are understood.
What you can do after
Apply it via Neo4j Graph Data Science procedures to select the relationship direction used by an algorithm.
How it connects
Connects degree centrality, graph projection, relationship weights, and node2vec embeddings.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.