I am new to Dgraph and now exploring the tour. I created types as described on step 3 and loaded the data as in this lesson: Load Data | Intro | Dgraph Tour
I am trying to query shortest path between nodes as described in the article:
{
path as shortest(from: 0xb, to: 0x2) {
friend
}
path(func: uid(path)) {
name
}
}
With some node pairs it works as expected, e.g. from: 0xb (“Michael”), to: 0x1 (“Sarah”), but with others it gives weird output. Examples are:
- from: 0xb (“Amit”), to: 0x2 (“Hyung Sin”):
Emptypath
array:
{
"data": {
"path": [],
"_path_": [
{
"friend": {
"friend": {
"uid": "0x2"
},
"uid": "0x5"
},
"uid": "0xb",
"_weight_": 2
}
]
}
- from: 0x4 (“Michael”), to: 0xb (“Amit”)
Only one node inpath
(source only):
{
"data": {
"path": [
{
"name": "Michael"
}
],
"_path_": [
{
"friend": {
"uid": "0xb"
},
"uid": "0x4",
"_weight_": 1
}
]
}
- from: 0x4 (“Michael”), to: 0xb (“Amit”)
Only one node inpath
(destination only):
{
"data": {
"path": [
{
"name": "Michael"
}
],
"_path_": [
{
"friend": {
"uid": "0x4"
},
"uid": "0xb",
"_weight_": 1
}
]
}
The _path_
content appears to be correct though.
It seems that only specific nodes can be shown in path
(“Michael”, “Sarah” and “Catalina”) while others cannot, but I do not understand what is wrong with these nodes and how one category is different from another.
I am launching Dgraph in Docker, tested on image dgraph/dgraph
, tags latest
, master
, v1.2.7
(all the same).
Is it a bug or I misunderstand something?