Skip to content

Commit

Permalink
made unit tests work by handling directed and undirected graphs when …
Browse files Browse the repository at this point in the history
…importing from csv
  • Loading branch information
eileen-kuehn committed Jul 27, 2018
1 parent fdd500e commit 7772227
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion graphi/graph_io/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import collections as abc_collection

from ..types import adjacency_graph
from ..types import undirected as undirected_graph


class ParserError(Exception):
Expand Down Expand Up @@ -197,7 +198,10 @@ def graph_reader(
else:
raise TypeError("parameter 'nodes_header' must be True, False, an iterable or a callable")
# fill graph with nodes
graph = adjacency_graph.AdjacencyGraph(nodes, undirected=undirected)
if undirected:
graph = undirected_graph.Undirected(nodes)
else:
graph = adjacency_graph.AdjacencyGraph(nodes, undirected=undirected)
# still need to consume the first line as content if not unset
iter_rows = reader if first_line is None else itertools.chain([first_line], reader)
for row_idx, row in enumerate(iter_rows):
Expand Down

0 comments on commit 7772227

Please sign in to comment.