Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ: $^,$$ value reversed #5779

Closed
cjdxhjj opened this issue Dec 7, 2023 · 5 comments
Closed

FAQ: $^,$$ value reversed #5779

cjdxhjj opened this issue Dec 7, 2023 · 5 comments
Labels
type/question Type: question about the product

Comments

@cjdxhjj
Copy link

cjdxhjj commented Dec 7, 2023

Please check the FAQ documentation before raising an issue

Describe the bug (required)

Your Environments (required)

  • OS: uname -a
  • Compiler: g++ --version or clang++ --version
  • CPU: lscpu
  • Commit id (e.g. a3ffc7d8)

How To Reproduce(required)

Steps to reproduce the behavior:
image
the edge begin from col:2615 to metric:f1ee2e6076724c8a9af40680d67ca549, but the id($^) return metric:f1ee2e6076724c8a9af40680d67ca549 and id($$) return col:2615

Expected behavior

Additional context

@cjdxhjj cjdxhjj added the type/bug Type: something is unexpected label Dec 7, 2023
@github-actions github-actions bot added affects/none PR/issue: this bug affects none version. severity/none Severity of bug labels Dec 7, 2023
@cjdxhjj
Copy link
Author

cjdxhjj commented Dec 7, 2023

what the source and target mean?

@cjdxhjj
Copy link
Author

cjdxhjj commented Dec 8, 2023

image
the src(edge), and dst(edge) return correct

@QingZ11 QingZ11 added type/question Type: question about the product and removed type/bug Type: something is unexpected severity/none Severity of bug affects/none PR/issue: this bug affects none version. labels Dec 11, 2023
@QingZ11
Copy link
Contributor

QingZ11 commented Dec 11, 2023

"src" and "dst" represent the starting point and the ending point of an edge, respectively, while $^ and $$ are reference symbols in the NebulaGraph query language nGQL, used to refer to the starting and ending points.

BTW, the term BIDIRECT represents a bidirectional edge, which will return the edge from 'a' to 'b' as well as the edge from 'b' to 'a'.

In this example, there may only exist a reverse edge, which is why the source and destination in the results are reversed.

@wey-gu
Copy link
Contributor

wey-gu commented Dec 11, 2023

Great catch!

You are seeing the nature difference between $$ and dst.

Each edge was persisted twice, one together with its starting vertex and one with the ending vertex(the inverse edge), and dst ensured the expected direction of this behavior.

You could add this typeid(edge) to better understand it, when typeid is negative, you are getting the edge that's the inverse edge.

go from "player100" over * bidirect yield dst(edge), src(edge), id($$), id($^), typeid(edge)
+-------------+-------------+-------------+-------------+--------------+
| dst(EDGE)   | src(EDGE)   | id($$)      | id($^)      | typeid(EDGE) |
+-------------+-------------+-------------+-------------+--------------+
| "player100" | "player101" | "player101" | "player100" | -5           |
| "player100" | "player102" | "player102" | "player100" | -5           |
| "player100" | "player104" | "player104" | "player100" | -5           |
| "player100" | "player105" | "player105" | "player100" | -5           |
| "player100" | "player107" | "player107" | "player100" | -5           |
| "player100" | "player108" | "player108" | "player100" | -5           |
| "player100" | "player109" | "player109" | "player100" | -5           |
| "player100" | "player113" | "player113" | "player100" | -5           |
| "player100" | "player125" | "player125" | "player100" | -5           |
| "player100" | "player144" | "player144" | "player100" | -5           |
| "post1"     | "player100" | "post1"     | "player100" | 9            |
| "post11"    | "player100" | "post11"    | "player100" | 9            |
| "player101" | "player100" | "player101" | "player100" | 5            |
| "player125" | "player100" | "player125" | "player100" | 5            |
| "addr_4"    | "player100" | "addr_4"    | "player100" | 14           |
| "team204"   | "player100" | "team204"   | "player100" | 4            |
+-------------+-------------+-------------+-------------+--------------+
Got 16 rows (time spent 3.472ms/12.645375ms)

@cjdxhjj
Copy link
Author

cjdxhjj commented Dec 12, 2023

thanks for your replay, @wey-gu @QingZ11

@cjdxhjj cjdxhjj closed this as completed Dec 12, 2023
@wey-gu wey-gu changed the title $^,$$ value reversed FAQ: $^,$$ value reversed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question Type: question about the product
Projects
None yet
Development

No branches or pull requests

3 participants