[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[],[],null,["# Work with a Spanner Graph visualization\n\nThis page describes how to work with a Spanner Graph visualization. A\nSpanner Graph visualization can show the graph elements returned by a\nquery or the elements of a graph schema. A visualization helps you understand\nhow data points (nodes) are connected (edges). While a table of hundreds of data\npoints can be difficult to interpret, its graph visualization can reveal\npatterns, dependencies, and anomalies.\n\nVisualize Spanner Graph query results\n-------------------------------------\n\nTo visualize Spanner Graph query results in Spanner\nStudio, the query must return graph elements in JSON format by using the\n[`SAFE_TO_JSON`](/spanner/docs/reference/standard-sql/json_functions#safe_to_json)\nor [`TO_JSON`](/spanner/docs/reference/standard-sql/json_functions#to_json)\nfunction. We recommend that you return graph paths instead of returning nodes\nand edges individually. Returning paths offers the following benefits:\n\n- Paths contain complete data of nodes and edges. Some intermediate nodes and\n edges in a visualization of a complex query might not be available if you\n return individual nodes and edges.\n\n- If you return paths, your `RETURN` statement can be less complex than if you\n return nodes and edges individually.\n\nThe following sample query returns the paths of account transfers, which you can\nvisualize: \n\n GRAPH FinGraph\n MATCH result_paths = (account:Account {is_blocked: True})-[:Transfers]-\u003e(dest_account:Account)\n RETURN SAFE_TO_JSON(result_paths) AS result_paths\n\nAfter you run a query, the query results area displays the visualization. The\ndetail panel shows a summary of node and edge labels with counts for each. Click\na node or an edge to navigate the graph and view properties, neighbors, and\nconnections, as the following screenshot shows. Alternatively, you can view the\nquery results as a table or toggle to a visualization of the underlying graph\nschema.\n\nFor more information, see\n[Return graph elements as JSON](/spanner/docs/graph/queries-overview#return-graph-elements-json).\n\nChoose a Spanner Graph visualization layout\n-------------------------------------------\n\nThe menu on the visualization panel provides the following layout options:\n\n- **Force layout (default)**: Presents nodes as points that repel each other,\n while connected nodes pull together, simulating physical forces to create a\n visually intuitive layout.\n\n- **Hierarchical**: Positions nodes to create a visual hierarchy based on\n connectivity.\n\n- **Sequential**: Positions nodes to create a visual sequence based on\n connectivity.\n\n- **Show labels**: Displays all node and edge labels on the graph at all zoom\n levels.\n\nTroubleshoot Spanner Graph visualizations\n-----------------------------------------\n\nThe following can help you troubleshoot and understand Spanner Graph\nvisualization issues and behavior.\n\n### A visualization doesn't appear for a Spanner Graph query\n\n**Issue**: You run a Spanner Graph query and it appears in table\nformat only.\n\n**Possible cause**: The query doesn't return graph elements in JSON format. For\nexample:\n\n- The following query can't be visualized because it returns nodes and edge identifiers:\n\n GRAPH FinGraph\n MATCH (person:Person {name: \"Dana\"})-[owns:Owns]-\u003e(account:Account)\n RETURN person.id as person_id, account.id as account_id\n\n- The following query can't be visualized because it returns property values:\n\n GRAPH FinGraph\n MATCH (person:Person {name: \"Dana\"})-[owns:Owns]-\u003e(account:Account)\n RETURN owns.create_time, account.nick_name\n\n**Recommended solution**:\n\nReturn graph elements in JSON format using\n[`SAFE_TO_JSON`](/spanner/docs/reference/standard-sql/json_functions#safe_to_json)\nor\n[`TO_JSON`](/spanner/docs/reference/standard-sql/json_functions#to_json). For\nmore information, see\n[Visualize Spanner Graph query results](#visualization-results).\n\n### Spanner Graph query results are partially visualized\n\n**Issue**: A query result visualization shows only a part of the query results.\n\n**Possible cause**: The query returns more than 10 MB of data. A query\nvisualization can display up to 10 MB of data.\n\n**Recommended solution**: Simplify the query so it returns less than 10 MB of\ndata.\n\n### A Spanner Graph visualization includes a node or edge with an unexpected label\n\n**Issue**: A node or an edge in a Spanner Graph visualization shows an\nunexpected label.\n\n**Possible cause**: The node or edge has multiple labels. A\nSpanner Graph visualization can show one label for each node and edge.\nIf a node or edge has more than one label, then the first label shows in the\nvisualization.\n\n**Recommended solution**: None. You can't change which label displays.\n\n### Some graph elements aren't displayed in a Spanner Graph visualization\n\n**Issue**: A visualization includes all of the returned nodes and edges, but\nsome of the graph elements aren't displayed.\n\n**Possible cause**: The query used to create the Spanner Graph\nvisualization returns individual nodes and edges instead of a graph path.\n\n**Recommended solution**: Update the query to return a graph path.\n\nWhat's next\n-----------\n\n- Learn how to [set up and query Spanner Graph](/spanner/docs/graph/set-up).\n- Learn about [Spanner Graph queries](/spanner/docs/graph/queries-overview).\n- Learn about [Spanner Graph schemas](/spanner/docs/graph/schema-overview).\n- Learn about [Spanner Graph visualization integrations](/spanner/docs/graph/visualization-integrations)."]]