Commit 2d16437e authored by Morten Knutsen's avatar Morten Knutsen
Browse files

Various fixes:

  * Add compatibility with NetworkX >= 1.6.
  * Use simple file reads in pajek.py
  * Add support for 100G interfaces
parent 8a8c4ab7
......@@ -438,7 +438,7 @@ class Model:
return True
return False
def get_edge_groups(self, threshold=0.01, n=20, edges=None, path=None):
def get_edge_groups(self, threshold=0.020, n=20, edges=None, path=None):
groups, mpath_edges, rpath_edges = {}, [], []
multi = False
mpath = path
......@@ -601,7 +601,11 @@ class Model:
return G
def _refresh_betweenness(self):
self.betweenness = nx.load_centrality(self.G, weighted_edges=True)
self.betweenness = None
if nx.__version__ > "1.5":
self.betweenness = nx.load_centrality(self.G, weight='weight')
else:
self.betweenness = nx.load_centrality(self.G, weighted_edges=True)
self.edge_betweenness = nx.edge_betweenness(self.G, True, True)
def _refresh_all_paths(self):
......@@ -1892,7 +1896,11 @@ class Simulation:
return H
def _refresh_betweenness(self):
self.betweenness = nx.load_centrality(self.graph, weighted_edges=True)
self.betweenness = None
if nx.__version__ > "1.5":
self.betweenness = nx.load_centrality(self.graph, weight='weight')
else:
self.betweenness = nx.load_centrality(self.graph, weighted_edges=True)
self.edge_betweenness = nx.edge_betweenness(self.graph, True, True)
def _refresh_effects(self, OG=None, NG=None):
......
......@@ -17,13 +17,14 @@ __author__ = """Aric Hagberg (hagberg@lanl.gov)"""
# Distributed under the terms of the GNU Lesser General Public License
# http://www.gnu.org/copyleft/lesser.html
import networkx
from networkx.utils import is_string_like,_get_fh
from networkx.utils import is_string_like
def read_pajek(path):
"""Read graph in pajek format from path. Returns an XGraph or XDiGraph.
"""
fh=_get_fh(path,mode='r')
G=parse_pajek(fh)
fh=open(path,mode='r')
lines = fh.readlines()
G=parse_pajek(lines)
return G
def parse_pajek(lines):
......
......@@ -50,6 +50,7 @@ class PlotUI:
'normalupath' : 2.5,
'normaloaltpath': 2,
'normalualtpath': 2.5,
100000000 : 15,
10000000 : 10,
2488000 : 6,
1000000 : 3,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment