newOS for Developers

Back to Skill Portal

Graph Traversal

Edge queries, relationship mapping, and network analysis

The __EDGES Table

Newgraph uses a graph database (Neo4j) on the backend. The client maintains a local cache of edges in IndexedDB. See Infrastructure → Cache for details.

// Edge key format:
"{entity}+{entityId}+{relationship}+{targetEntity}"

// Examples:
folder+abc123+attachment+post     // Posts in folder abc123
user+xyz789+author+folder         // Folders by user xyz789
user+xyz789+rates+user            // Users that xyz789 follows
folder+abc123+access+user         // Users with access to folder

// Value is an array of target IDs:
["post-1", "post-2", "post-3"]

Available Skills

intermediate

Query relationships from the __EDGES cache table

IndexedDB

Get posts in a folder via edge traversal

folder+{id}+attachment+post
intermediate

Traverse powered/powering relationships

user+{id}+powered+user
intermediate

Query mood access permissions via edges

folder+{id}+access+user

Direct edge connections from a node

getEdges(type, id)
Two-Hop Querydocs
advancedComing Soon

Friends-of-friends style traversal

nested getEdges()

Common Edge Patterns

Full reference in Infrastructure → Cache → Edge Patterns

PatternMeaningUsed By
folder+id+attachment+postPosts in folderreadPosts()
user+id+author+folderFolders by usergetUserMoods()
user+id+author+userAgents by userlistAgentsByAuthor()
folder+id+access+userUsers with accessgetGrantees()
user+id+rates+userFollowinggetRatedOut()