YMatrix
Quick Start
Connecting
Benchmarks
Deployment
Data Usage
Manage Clusters
Upgrade
Global Maintenance
Expansion
Monitoring
Security
Best Practice
Technical Principles
Data Type
Storage Engine
Execution Engine
Streaming Engine(Domino)
MARS3 Index
Extension
Advanced Features
Advanced Query
Federal Query
Grafana
Backup and Restore
Disaster Recovery
Graph Database
Introduction
Clauses
Functions
Advanced
Guide
Performance Tuning
Troubleshooting
Tools
Configuration Parameters
SQL Reference
In AGE, a map is a data structure that stores a collection of key-value pairs. Each key in a map is unique and associated with a corresponding value. This structure resembles a dictionary in Python or an object in JavaScript, providing an efficient way to organize and retrieve data by key. This section covers functions that enable you to generate and manipulate maps effectively.
vertex_stats()The vertex_stats() function extracts metadata from a vertex. When you pass a vertex to vertex_stats(), it returns a structured map containing the following key-value pairs:
id: The unique identifier assigned to the vertex. label: The label or type used to classify the vertex. in_degree: The number of incoming edges directed toward the vertex. out_degree: The number of outgoing edges originating from the vertex. self_loops: The number of self-loop edges associated with the vertex.Syntax: vertex_stats(vertex)
-- Create the graph.
SELECT create_graph('vertex_stats_graph');
-- Create vertices and edges.
SELECT * FROM cypher('vertex_stats_graph', $$
CREATE (:Person {name: 'John Donne'})-[:WROTE]->(:Poem {title: 'Holy Sonnet XIV'})
$$) AS (a agtype);
SELECT * FROM cypher('vertex_stats_graph', $$
MATCH (v:Poem {title: 'Holy Sonnet XIV'})
RETURN vertex_stats(v)
$$) AS (vertex_stats agtype);
| vertex_stats |
|---|
| {"id": 1407374883553281, "label": "Poem", "in_degree": 1, "out_degree": 0, "self_loops": 0} |
You can retrieve individual values from the resulting map using subscript notation:vertex_stats(vertex)["key"]