Skip to content

Commit

Permalink
Merge pull request #242 from netsiphd/degdiv-tweak
Browse files Browse the repository at this point in the history
Use N or N-1 instead of empirical kmax in degree histogram
  • Loading branch information
leotrs authored Aug 2, 2019
2 parents 749adbc + 96c562d commit f049318
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion netrd/distance/degree_divergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def degree_vector_histogram(graph):
"""
vec = np.array(list(dict(graph.degree()).values()))
max_deg = max(vec)
if next(graph.selfloop_edges(), False):
max_deg = len(graph)
else:
max_deg = len(graph) - 1
counter = Counter(vec)
hist = np.array([counter[v] for v in range(max_deg)])
return vec, hist
Expand Down

0 comments on commit f049318

Please sign in to comment.