MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestShortestPathWithDepth_no_direct_path

Function TestShortestPathWithDepth_no_direct_path

query/query3_test.go:1359–1458  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1357}
1358
1359func TestShortestPathWithDepth_no_direct_path(t *testing.T) {
1360 // There is no direct path between A and E and the shortest path is for depth 3.
1361 query := `
1362 query test ($depth: int) {
1363 a as var(func: eq(name, "A"))
1364 b as var(func: eq(name, "E"))
1365
1366 path as shortest(from: uid(a), to: uid(b), depth: $depth) {
1367 connects @facets(weight)
1368 }
1369
1370 path(func: uid(path)) {
1371 uid
1372 name
1373 }
1374 }`
1375
1376 shortestPath := `{
1377 "data": {
1378 "path": [
1379 {
1380 "uid": "0x33",
1381 "name": "A"
1382 },
1383 {
1384 "uid": "0x35",
1385 "name": "C"
1386 },
1387 {
1388 "uid": "0x36",
1389 "name": "D"
1390 },
1391 {
1392 "uid": "0x37",
1393 "name": "E"
1394 }
1395 ],
1396 "_path_": [
1397 {
1398 "connects": {
1399 "connects": {
1400 "connects": {
1401 "uid": "0x37",
1402 "connects|weight": 1
1403 },
1404 "uid": "0x36",
1405 "connects|weight": 1
1406 },
1407 "uid": "0x35",
1408 "connects|weight": 1
1409 },
1410 "uid": "0x33",
1411 "_weight_": 3
1412 }
1413 ]
1414 }
1415 }`
1416

Callers

nothing calls this directly

Calls 2

processQueryWithVarsFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected