Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wrong counting of paths in PathCollection #120

Description

@IngoScholtes

The path counts in the PathCollection are wrongly aggregated. Consider the following code:

>>> p1 = pp.Path('a', 'x', 'c', uid='a-x-c')
>>> p2 = pp.Path('b', 'x', 'd', uid='b-x-d')
>>> pc = pp.PathCollection()
>>> pc.add(p1)
>>> pc.add(p2)
>>> pc.add(p2)
>>> print(pc.counter)
PathPyCounter({'b-x-d': 2, 'a-x-c': 1})

>>> p3 = pp.Path('b', 'x', 'd', uid='b-x-d-2')
>>> pc.add(p3)
>>> print(pc.counter)
PathPyCounter({'b-x-d': 3, 'a-x-c': 1})

Due to the different UIDs, I would expect the paths b-x-d and b-x-d-2 to be counted separately. If the paths are counted based on the traversed nodes, then we should not use the uid of the first path b-x-d in the counter.

I guess the general question is that we need to specify what is the difference between the following lines:

pc.add(pp.Path('a', 'b', uid='x'), count=2)
pc.add(pp.Path('a', 'b', uid='x'), count=1)
pc.add(pp.Path('a', 'b', uid='y'), count=1)

I would argue that we should count the paths based on their uid.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

discussionDiscussions on pathpy development and scientific approachesmodule:coreSometing related to the pathpy core

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions