Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
Netzschleuder
Commits
42e10c0c
Commit
42e10c0c
authored
Aug 13, 2020
by
Tiago Peixoto
Browse files
Fix get_hgap() for very small networks
parent
c6c31faa
Changes
1
Hide whitespace changes
Inline
Side-by-side
analyze.py
View file @
42e10c0c
...
...
@@ -217,8 +217,12 @@ def get_hgap(g):
g
=
GraphView
(
g
,
directed
=
False
)
remove_parallel_edges
(
g
)
T
=
hashimoto
(
g
,
compact
=
True
,
operator
=
True
)
ew
=
scipy
.
sparse
.
linalg
.
eigs
(
T
,
k
=
1
,
which
=
"LR"
,
return_eigenvectors
=
False
)
g
.
clear
()
try
:
ew
=
scipy
.
sparse
.
linalg
.
eigs
(
T
,
k
=
1
,
which
=
"LR"
,
return_eigenvectors
=
False
)
except
TypeError
:
return
numpy
.
nan
finally
:
g
.
clear
()
return
float
(
ew
.
real
[
0
])
@
register
(
"diameter"
,
"(Pseudo-) diameter"
)
...
...
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