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

Why does NebulaGraph-NX only read edge information, when the input should be a graph? #5

Open
jiagh2010 opened this issue Apr 24, 2024 · 1 comment
Labels

Comments

@jiagh2010
Copy link

jiagh2010 commented Apr 24, 2024

Why does NebulaGraph-nx only read edge information, when the input should be a graph?】

config = NebulaGraphConfig(
    space="basketballplayer",
    graphd_hosts="127.0.0.1:9669",
    metad_hosts="127.0.0.1:9559",
    user = "root",
    password = "nebula"
)


reader = NebulaReader(
    edges=["follow", "serve"],
    properties=[["degree"], ["start_year", "end_year"]],
    nebula_config=config, limit=10000)

g = reader.read()

pr = nx.pagerank(
    g, alpha=0.85,
    max_iter=100,
    tol=1e-06,
    weight='degree')
print(pr)
@wey-gu
Copy link
Owner

wey-gu commented Aug 22, 2024

@jiagh2010 I added a NebulaQueryReader for such use cases, please give a try :)

NebulaReader is for scan whole graph of data while NebulaQueryReader is for construct any query into nx object

from ng_nx import NebulaQueryReader
from ng_nx.utils import NebulaGraphConfig

config = NebulaGraphConfig(
    space="demo_basketballplayer",
    graphd_hosts="127.0.0.1:9669",
    metad_hosts="127.0.0.1:9559"
)

reader = NebulaQueryReader(nebula_config=config)

# Execute a custom query
query = "MATCH p=(v:player{name:'Tim Duncan'})-[e:follow*1..3]->(v2) RETURN p"
g = reader.read(query)

close via #7

@wey-gu wey-gu changed the title NebulaGraph-nx, Why does NebulaGraph-nx only read edge information, when the input should be a graph? Why does NebulaGraph-NX only read edge information, when the input should be a graph? Aug 22, 2024
@wey-gu wey-gu added the sovled label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants