Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dirk.wintergruen
network_extensions
Commits
c4413c07
Commit
c4413c07
authored
Jul 30, 2021
by
dirk.wintergruen
Browse files
added parameter fill empty
parent
f09b0b11
Changes
1
Hide whitespace changes
Inline
Side-by-side
network_extensions/igraphx/__init__.py
View file @
c4413c07
...
...
@@ -1427,6 +1427,7 @@ def calcTop(
displayAttr2
=
None
,
deleteZero
=
True
,
normalize
=
None
,
fill_empty
=
False
,
**
kwargs
):
"""
...
...
@@ -1443,6 +1444,7 @@ def calcTop(
:param displayAttr2: Additional attribute, defaults to None
:param deleteZero: Don't return entries with value 0, defaults to True
:param normalize: Normalize the results, value can be None, mean or median, defaults to None
:param fill_empty: extend all entries to the length number, defaults to false
:param kwargs: kwargs to be passed to the centrality to function see above
:return:
"""
...
...
@@ -1520,7 +1522,10 @@ def calcTop(
bct_pairs_sorted
=
sorted
(
bct_pairs
,
key
=
lambda
x
:
x
[
-
1
])
bct_pairs_sorted
.
reverse
()
return
bct_pairs_sorted
[
0
:
number
]
ret
=
bct_pairs_sorted
[
0
:
number
]
if
len
(
ret
)
<
number
and
fill_empty
:
ret
=
ret
+
[(
""
,
math
.
nan
)
for
x
in
range
(
0
,
number
-
len
(
ret
))]
return
ret
def
calcTopsForYears
(
...
...
@@ -1534,6 +1539,7 @@ def calcTopsForYears(
displayAttr2
=
None
,
deleteZero
=
True
,
normalize
=
None
,
fill_empty
=
False
,
mode
=
"vertex"
,
**
kwargs
):
...
...
@@ -1550,6 +1556,7 @@ def calcTopsForYears(
:param displayAttr2: Additional attribute, defaults to None
:param deleteZero: Don't return entries with value 0, defaults to True
:param normalize: Normalize the results, value can be None, mean or median, defaults to None
:param fill_empty: extend all entries to the length number, defaults to false
:param kwargs: kwargs to be passed to the centrality to function see above
:return:
...
...
@@ -1593,6 +1600,7 @@ def calcTopsForYears(
deleteZero
=
deleteZero
,
normalize
=
normalize
,
mode
=
mode
,
fill_empty
=
fill_empty
,
**
kwargs
)
...
...
@@ -1608,6 +1616,7 @@ def calcTopsForYears(
deleteZero
=
deleteZero
,
normalize
=
normalize
,
mode
=
mode
,
fill_empty
=
fill_empty
,
**
kwargs
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment