Skip to content

Commit

Permalink
Merge branch 'pathpy2' of https://github.com/sg-dev/pathpy into pathpy2
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoScholtes committed Apr 20, 2018
2 parents 21d100d + 3e7f796 commit a0277d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions pathpy/classes/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def summary(self):
if 1 not in self.paths:
len_1 = 0
else:
len_1 = len(self.paths[1])
len_1 = len(self.paths[1])

summary_info = {
"lpsum": np.sum(l_path_sum),
Expand Down Expand Up @@ -288,7 +288,7 @@ def unique_paths(self, l=0, consider_longer_paths=True):
num_l = 0.0
if not self.paths:
return num_l

max_length = l
if consider_longer_paths:
max_length = max(self.paths) if self.paths else 0
Expand Down Expand Up @@ -636,11 +636,9 @@ def add_path_ngram(self, ngram, separator=',', expand_subpaths=True, frequency=(
by default all subpaths of the given ngram are generated, i.e.
for the trigram a;b;c a path a->b->c of length two will be generated
as well as two subpaths a->b and b->c of length one
frequency: int
the number of occurrences (i.e. frequency) of the ngram
Returns
-------
frequency: tuple
the number of occurrences (i.e. frequency) of the ngram (n_subpaths, n_observed)
the default is (0, 1) (i.e. 0 subpaths and one observed longest path)
"""
path = tuple(ngram.split(separator))
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def random_ngram(p_len, nodes):
frequency = np.random.randint(1, 4)
path_length = np.random.randint(1, 10)
path_to_add = random_ngram(path_length, node_set)
paths.add_path_ngram(path_to_add, frequency=frequency)
paths.add_path_ngram(path_to_add, frequency=(0, frequency))

return paths

Expand Down

0 comments on commit a0277d5

Please sign in to comment.