@@ -90,6 +90,53 @@ const ToggleButton = styled.button`
90
90
}
91
91
` ;
92
92
93
+ const TwoColumnContainer = styled . div `
94
+ display: flex;
95
+ gap: 32px;
96
+ width: 100%;
97
+ @media (max-width: 900px) {
98
+ flex-direction: column;
99
+ gap: 0;
100
+ }
101
+ ` ;
102
+
103
+ const LeftColumn = styled . div `
104
+ flex: 2;
105
+ min-width: 320px;
106
+ ` ;
107
+
108
+ const RightColumn = styled . div `
109
+ flex: 1;
110
+ min-width: 320px;
111
+ background: ${ bankerPanel } ;
112
+ border: 1px solid ${ bankerAccent } ;
113
+ border-radius: 8px;
114
+ padding: 20px;
115
+ color: ${ bankerText } ;
116
+ font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
117
+ font-size: 0.98rem;
118
+ white-space: pre-wrap;
119
+ overflow-x: auto;
120
+ margin-left: 16px;
121
+ ` ;
122
+
123
+ const CodeTitle = styled . div `
124
+ font-weight: bold;
125
+ color: ${ bankerAccent } ;
126
+ margin-bottom: 12px;
127
+ ` ;
128
+
129
+ const PanelSection = styled . div `
130
+ margin-bottom: 32px;
131
+ padding-bottom: 16px;
132
+ border-bottom: 1px solid ${ bankerAccent } ;
133
+ &:last-child {
134
+ border-bottom: none;
135
+ margin-bottom: 0;
136
+ padding-bottom: 0;
137
+ }
138
+ ` ;
139
+
93
140
const Graph = ( ) => {
94
141
const [ cy , setCy ] = useState ( null ) ;
95
142
const [ isCollapsed , setIsCollapsed ] = useState ( true ) ;
@@ -194,6 +241,61 @@ const Graph = () => {
194
241
}
195
242
}
196
243
244
+ const staticCreateSnippet = `
245
+ CREATE PROPERTY GRAPH "bank_graph"
246
+ VERTEX TABLES (
247
+ "FINANCIAL"."ACCOUNTS"
248
+ KEY ( "ACCOUNT_ID" )
249
+ PROPERTIES ( "ACCOUNT_BALANCE", "ACCOUNT_ID", "ACCOUNT_NAME", "ACCOUNT_OPENED_DATE", "ACCOUNT_OTHER_DETAILS", "ACCOUNT_TYPE", "CUSTOMER_ID" )
250
+ )
251
+ EDGE TABLES (
252
+ "FINANCIAL"."TRANSFERS" KEY ( "TXN_ID" )
253
+ SOURCE KEY ( "SRC_ACCT_ID" ) REFERENCES "ACCOUNTS"( "ACCOUNT_ID" )
254
+ DESTINATION KEY ( "DST_ACCT_ID" ) REFERENCES "ACCOUNTS"( "ACCOUNT_ID" )
255
+ PROPERTIES ( "AMOUNT", "DESCRIPTION", "DST_ACCT_ID", "SRC_ACCT_ID", "TXN_ID" )
256
+ )
257
+ ` ;
258
+
259
+ const staticCytoscapeSnippet = `
260
+ function plotTransferEdge(cy, tx, index) {
261
+ cy.add({
262
+ data: {
263
+ id: \`txn$\{tx.TXN_ID || \`$\{tx.src}_\${tx.dst}_\${index}\`}\`,
264
+ source: String(tx.SRC_ACCT_ID || tx.src),
265
+ target: String(tx.DST_ACCT_ID || tx.dst),
266
+ label: tx.DESCRIPTION || tx.description || ''
267
+ }
268
+ });
269
+ }
270
+ ` ;
271
+
272
+ const staticPGXPythonSQLEtcSnippet = `
273
+ %custom-algorithm-pgx
274
+ // Write your GraphAlgorithm code here
275
+
276
+ %pgql-pgx
277
+ /* Query and visualize 100 elements (nodes and edges) of BANK_GRAPH */
278
+ SELECT * FROM match (s)-[t]->(d) on bank_graphLIMIT 100
279
+
280
+ %java-pgx
281
+ PgxGraph graph = session.readGraphWithProperties(dataSourceName, 'graphName')
282
+
283
+ %sparql-rdf
284
+ SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 15
285
+
286
+ %pgql-rdbms
287
+ SELECT n,e,m FROM MATCH (n) -[e]-> (m) ON GRAPH_NAME
288
+
289
+ %sql
290
+ SELECT * FROM TABLE_NAME
291
+
292
+ %python-pgx
293
+ GRAPH_NAME="BANK_GRAPH"
294
+ graph = session.get_graph(GRAPH_NAME)
295
+
296
+ %conda
297
+ ` ;
298
+
197
299
return (
198
300
< PageContainer >
199
301
< h2 > Process: Detect Money Laundering</ h2 >
@@ -272,16 +374,40 @@ const Graph = () => {
272
374
) }
273
375
</ SidePanel >
274
376
275
- { /* Cytoscape Graph */ }
276
- < GraphContainer id = "cy" > </ GraphContainer >
277
-
278
- { /* Generate Transactions Button */ }
279
- < GenerateButton onClick = { ( ) => generateCircularTransfersAndGraph ( cy ) } >
280
- Generate transactions to see corresponding graph
281
- </ GenerateButton >
282
- < DangerButton onClick = { clearAllTransfers } >
283
- Clear all transfer history
284
- </ DangerButton >
377
+ < TwoColumnContainer >
378
+ < LeftColumn >
379
+ { /* Cytoscape Graph */ }
380
+ < GraphContainer id = "cy" > </ GraphContainer >
381
+
382
+ { /* Generate/Clear Buttons */ }
383
+ < GenerateButton onClick = { ( ) => generateCircularTransfersAndGraph ( cy ) } >
384
+ Generate transactions to see corresponding graph
385
+ </ GenerateButton >
386
+ < DangerButton onClick = { clearAllTransfers } >
387
+ Clear all transfer history
388
+ </ DangerButton >
389
+ </ LeftColumn >
390
+ < RightColumn >
391
+ < PanelSection >
392
+ < CodeTitle > Create the graph...</ CodeTitle >
393
+ < code >
394
+ { staticCreateSnippet }
395
+ </ code >
396
+ </ PanelSection >
397
+ < PanelSection >
398
+ < CodeTitle > Use Cytoscape to visualize and analyze the graph...</ CodeTitle >
399
+ < code >
400
+ { staticCytoscapeSnippet }
401
+ </ code >
402
+ </ PanelSection >
403
+ < PanelSection >
404
+ < CodeTitle > Use PGX, Python, SQL, etc. to conduct graph operations, visualize, etc...</ CodeTitle >
405
+ < code >
406
+ { staticPGXPythonSQLEtcSnippet }
407
+ </ code >
408
+ </ PanelSection >
409
+ </ RightColumn >
410
+ </ TwoColumnContainer >
285
411
</ PageContainer >
286
412
) ;
287
413
} ;
0 commit comments