Skip to content

Commit 933e8b5

Browse files
committed
readwrite.graph_to_table: Return an empty table for empty graph
1 parent 88137ae commit 933e8b5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

orangecontrib/network/readwrite.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import networkx.readwrite.gml as rwgml
2626
import networkx.readwrite.gpickle as rwgpickle
2727

28-
from Orange.data import Table
28+
from Orange.data import Table, Domain, StringVariable
2929

3030
from .network import Graph, DiGraph, MultiGraph, MultiDiGraph
3131

@@ -110,7 +110,8 @@ def graph_to_table(G):
110110
fp.close()
111111
table = Table(fp.name)
112112
os.unlink(fp.name)
113-
113+
else:
114+
table = Table(Domain([], [], [StringVariable("id")]), [])
114115
return table
115116

116117

0 commit comments

Comments
 (0)