Permalink
Browse files

fixing bug in to_undirected

  • Loading branch information...
IngoScholtes committed Jan 14, 2019
1 parent eba30ea commit e4630834458e85645151049b63281da819871e4d
Showing with 8 additions and 4 deletions.
  1. +8 −4 pathpy/classes/network.py
@@ -191,7 +191,11 @@ def from_sqlite(cls, cursor, directed=True):
A Network instance created from the SQLite database.
"""
n = cls(directed=directed)
from pathpy.classes import DAG
if cls == DAG:
n = cls()
else:
n = cls(directed=directed)

assert cursor.connection.row_factory, \
'Cannot access columns by name. Please set ' \
@@ -207,7 +211,7 @@ def from_sqlite(cls, cursor, directed=True):

@classmethod
def from_paths(cls, paths):
r"""Gemerates a weighted directed network from a Paths
r"""Generates a weighted directed network from a Paths
object. The weight of directed links will correspond
to the statistics of (sub)-paths of length one"""
network = cls(directed=True)
@@ -256,8 +260,8 @@ def to_undirected(self):
n = Network(directed = False)

for (v,w) in self.edges:
if v!=w:
n.add_edge(v, w)
#if v!=w:
n.add_edge(v, w)
return n


0 comments on commit e463083

Please sign in to comment.