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

HigherOrderGraph.predecessors returns unexpected values #37

Closed
jvpichowski opened this issue Nov 22, 2023 · 1 comment · Fixed by #48
Closed

HigherOrderGraph.predecessors returns unexpected values #37

jvpichowski opened this issue Nov 22, 2023 · 1 comment · Fixed by #48
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@jvpichowski
Copy link
Collaborator

I suspect that the predecessors method returns wrong values for HigherOrderGraphs.
Right now, it inherits the implementation from Graph.

The self-containing example:

import pathpyG as pp
paths = pp.PathData.from_csv('../data/tube_paths_train.ngram')

k = 2
higher_order = pp.HigherOrderGraph(paths, order=k, node_id=paths.node_id)

nodes = list(higher_order.nodes)

node = nodes[2]

print(node)
print(list(higher_order.successors(node)))      
# -> seems to be okay
print(list(higher_order.predecessors(node)))    
# -> wrong, expected [('Embankment', 'Waterloo') , ('Westminster', 'Waterloo'), ('Kennington', 'Waterloo'), ...]

results in

('Waterloo', 'Southwark')
[('Southwark', 'London Bridge')]
[('Southwark', 'Waterloo'), ('Southwark', 'Waterloo'), ('Southwark', 'Waterloo'), ('Southwark', 'Waterloo')]

You can copy the example to a notebook in the tutorials folder.

@jvpichowski jvpichowski added the bug Something isn't working label Nov 22, 2023
@IngoScholtes IngoScholtes self-assigned this Nov 28, 2023
@IngoScholtes IngoScholtes added this to the NeurIPS 2023 milestone Nov 28, 2023
@IngoScholtes
Copy link
Member

I just add a test case that reproduces this issue.

@IngoScholtes IngoScholtes added the good first issue Good for newcomers label Nov 28, 2023
IngoScholtes added a commit that referenced this issue Nov 28, 2023
@IngoScholtes IngoScholtes linked a pull request Nov 28, 2023 that will close this issue
IngoScholtes added a commit that referenced this issue Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants