Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
verktoy
PyMetric
Commits
5cbf08be
Commit
5cbf08be
authored
Sep 04, 2015
by
Morten Knutsen
Browse files
Use distutils.version for version comparisons.
parent
0cece8ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
model.py
View file @
5cbf08be
import
networkx
as
nx
from
pajek
import
read_pajek
import
utils
import
distutils.version
class
Model
:
...
...
@@ -602,7 +603,7 @@ class Model:
def
_refresh_betweenness
(
self
):
self
.
betweenness
=
None
if
nx
.
__version__
>
"1.5"
:
if
distutils
.
version
.
StrictVersion
(
nx
.
__version__
)
>
distutils
.
version
.
StrictVersion
(
"1.5"
)
:
self
.
betweenness
=
nx
.
load_centrality
(
self
.
G
,
weight
=
'weight'
)
else
:
self
.
betweenness
=
nx
.
load_centrality
(
self
.
G
,
weighted_edges
=
True
)
...
...
@@ -1897,7 +1898,7 @@ class Simulation:
def
_refresh_betweenness
(
self
):
self
.
betweenness
=
None
if
nx
.
__version__
>
"1.5"
:
if
distutils
.
version
.
StrictVersion
(
nx
.
__version__
)
>
distutils
.
version
.
StrictVersion
(
"1.5"
)
:
self
.
betweenness
=
nx
.
load_centrality
(
self
.
graph
,
weight
=
'weight'
)
else
:
self
.
betweenness
=
nx
.
load_centrality
(
self
.
graph
,
weighted_edges
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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