graph-to-table 연산자는 그래프에서 테이블로 노드 또는 가장자리를 내보냅니다.
문법
노드
G|graph-to-tablenodes [ with_node_id=ColumnName ]
에지
G|edgesgraph-to-table [ with_source_id=ColumnName ] [ with_target_id=ColumnName ] [ asTableName ]
노드 및 에지
G(G)|graph-to-tablenodesasNodesTableName [ with_node_id=ColumnName ],edgesasEdgesTableName [ with_source_id=ColumnName ] [ with_target_id=ColumnName ]
매개 변수
| 이름 | 유형 | 필수 | 설명 |
|---|---|---|---|
| G | string |
✔️ | 입력 그래프 원본입니다. |
| NodesTableName | string |
내보낸 노드 테이블의 이름입니다. | |
| EdgesTableName | string |
내보낸 에지 테이블의 이름입니다. | |
| columnName | string |
지정된 열 이름을 사용하여 노드 해시 ID, 원본 노드 해시 ID 또는 대상 노드 해시 ID를 내보냅니다. |
반품
노드
연산자는 graph-to-table 각 행이 원본 그래프의 노드에 해당하는 테이블 형식 결과를 반환합니다. 반환된 열은 노드의 속성입니다.
with_node_id 제공되면 노드 해시 열의 long 형식이 지정됩니다.
에지
연산자는 graph-to-table 각 행이 원본 그래프의 가장자리에 해당하는 테이블 형식 결과를 반환합니다. 반환된 열은 노드의 속성입니다.
with_source_id 제공 with_target_id 되거나 제공되면 노드 해시 열의 long 형식이 지정됩니다.
노드 및 에지
연산자는 graph-to-table 이전 설명과 일치하는 두 개의 테이블 형식 결과를 반환합니다.
예시
다음 예제에서는 연산자가 그래프에서 테이블로 가장자리를 내보내는 방법을 graph-to-table 나타냅니다. 및 with_source_id 매개 변수는 with_target_id 각 에지의 원본 및 대상 노드에 대한 노드 해시를 내보냅니다.
let nodes = datatable(name:string, type:string, age:long)
[
"Alice", "Person", 23,
"Bob", "Person", 31,
"Eve", "Person", 17,
"Mallory", "Person", 29,
"Trent", "System", 99
];
let edges = datatable(source:string, destination:string, edge_type:string)
[
"Alice", "Bob", "communicatesWith",
"Alice", "Trent", "trusts",
"Bob", "Trent", "hasPermission",
"Eve", "Alice", "attacks",
"Mallory", "Alice", "attacks",
"Mallory", "Bob", "attacks"
];
edges
| make-graph source --> destination with nodes on name
| graph-to-table edges with_source_id=SourceId with_target_id=TargetId
출력
| SourceId | 대상 ID | 근원 | 목적지 | edge_type |
|---|---|---|---|---|
| -3122868243544336885 | -7133945255344544237 | 앨리스 | 밥 | communicatesWith |
| -3122868243544336885 | 2533909231875758225 | 앨리스 | 트 렌트 | 트러스트 |
| -7133945255344544237 | 2533909231875758225 | 밥 | 트 렌트 | hasPermission |
| 4363395278938690453 | -3122868243544336885 | 이브 | 앨리스 | 공격 |
| 3855580634910899594 | -3122868243544336885 | Mallory | 앨리스 | 공격 |
| 3855580634910899594 | -7133945255344544237 | Mallory | 밥 | 공격 |
노드 가져오기
다음 예제에서는 연산자가 graph-to-table 그래프에서 테이블로 노드를 내보내는 방법을 보여 줍니다. 매개 변수는 with_node_id 노드 해시를 내보냅니다.
let nodes = datatable(name:string, type:string, age:long)
[
"Alice", "Person", 23,
"Bob", "Person", 31,
"Eve", "Person", 17,
"Trent", "System", 99
];
let edges = datatable(source:string, destination:string, edge_type:string)
[
"Alice", "Bob", "communicatesWith",
"Alice", "Trent", "trusts",
"Bob", "Trent", "hasPermission",
"Eve", "Alice", "attacks",
"Mallory", "Alice", "attacks",
"Mallory", "Bob", "attacks"
];
edges
| make-graph source --> destination with nodes on name
| graph-to-table nodes with_node_id=NodeId
출력
| NodeId | 이름 | 유형 | 연령 |
|---|---|---|---|
| -3122868243544336885 | 앨리스 | 사람 | 23 |
| -7133945255344544237 | 밥 | 사람 | 31 |
| 4363395278938690453 | 이브 | 사람 | 17 |
| 2533909231875758225 | 트 렌트 | 시스템 | 99 |
| 3855580634910899594 | Mallory |
다음 예제에서는 연산자를 graph-to-table 사용하여 그래프에서 테이블로 노드와 가장자리를 내보냅니다.
let nodes = datatable(name:string, type:string, age:long)
[
"Alice", "Person", 23,
"Bob", "Person", 31,
"Eve", "Person", 17,
"Trent", "System", 99
];
let edges = datatable(source:string, destination:string, edge_type:string)
[
"Alice", "Bob", "communicatesWith",
"Alice", "Trent", "trusts",
"Bob", "Trent", "hasPermission",
"Eve", "Alice", "attacks",
"Mallory", "Alice", "attacks",
"Mallory", "Bob", "attacks"
];
edges
| make-graph source --> destination with nodes on name
| graph-to-table nodes as N with_node_id=NodeId, edges as E with_source_id=SourceId;
N;
E
출력 테이블 1
| NodeId | 이름 | 유형 | 연령 |
|---|---|---|---|
| -3122868243544336885 | 앨리스 | 사람 | 23 |
| -7133945255344544237 | 밥 | 사람 | 31 |
| 4363395278938690453 | 이브 | 사람 | 17 |
| 2533909231875758225 | 트 렌트 | 시스템 | 99 |
| 3855580634910899594 | Mallory |
출력 테이블 2
| SourceId | 근원 | 목적지 | edge_type |
|---|---|---|---|
| -3122868243544336885 | 앨리스 | 밥 | communicatesWith |
| -3122868243544336885 | 앨리스 | 트 렌트 | 트러스트 |
| -7133945255344544237 | 밥 | 트 렌트 | hasPermission |
| 4363395278938690453 | 이브 | 앨리스 | 공격 |
| 3855580634910899594 | Mallory | 앨리스 | 공격 |
| 3855580634910899594 | Mallory | 밥 | 공격 |
관련 콘텐츠
- 그래프 연산자
- make-graph 연산자