Graph Query Keywords
This section provides information about keywords that you can use in graph queries for Macrometa Global Data Network (GDN).
📄️ GRAPH
The GRAPH keyword in C8QL is used to specify a named graph in your Macrometa database when performing graph operations, such as traversals or finding the shortest path. A named graph groups together vertex and edge collections representing a specific graph structure, simplifying complex graph data management.
📄️ OUTBOUND | INBOUND | ANY
OUTBOUND, INBOUND, and ANY are used to specify the direction of graph traversal when performing operations such as traversals or finding the shortest path. These keywords help you control how the traversal follows the edges in the graph, allowing you to customize the query to fit your specific use case.
📄️ PRUNE
The PRUNE keyword in C8QL is used in conjunction with graph traversal queries to optimize performance by controlling the traversal process. It helps to reduce the number of paths explored during the traversal by stopping further exploration of a path if a specified condition is met.
📄️ SHORTEST_PATH
The SHORTEST_PATH keyword in C8QL is used to find the shortest path between two vertices in a graph. By default the shortest path is calculated by the number of edges (hops) between a start vertex and a target vertex. You can specify a weight attribute, in which case the shortest path would be the one with the smallest sum of weights over the edges in the path. If it finds two paths with the same shortest length, then it returns only one.
📄️ K_SHORTEST_PATHS
The KSHORTESTPATHS keyword in C8QL is used to find the top k shortest paths between two vertices in a graph. It computes a specified number of shortest paths (k) between a start vertex and a target vertex. This can be useful when you want to find alternative routes or paths in a network, such as finding several shortest routes in a transportation network or multiple connection chains in a social network.