Commit 7ab047ae authored by Tiago Peixoto's avatar Tiago Peixoto

Modify Graph.add_edge_list() to ignore extra rows

parent 8e7b5ca3
Pipeline #439 failed with stage
in 219 minutes and 28 seconds
......@@ -152,6 +152,8 @@ struct add_edge_list_hash
for (; iter != end; ++iter)
eprops.emplace_back(*iter, writable_edge_properties());
size_t n_props = std::min(eprops.size(), edge_list.shape()[1] - 2);
auto get_vertex = [&] (const Value& r) -> size_t
{
auto iter = vertices.find(r);
......@@ -170,7 +172,7 @@ struct add_edge_list_hash
size_t s = get_vertex(e[0]);
size_t t = get_vertex(e[1]);
auto ne = add_edge(vertex(s, g), vertex(t, g), g).first;
for (size_t i = 0; i < e.size() - 2; ++i)
for (size_t i = 0; i < n_props; ++i)
{
try
{
......
......@@ -2108,7 +2108,8 @@ class Graph(object):
def wrap(elist):
for row in elist:
yield (val if i < 2 else convert[i - 2](val)
for (i, val) in enumerate(row))
for (i, val) in enumerate(row)
if len(convert) > i - 2)
edge_list = wrap(edge_list)
if not hashed:
if isinstance(edge_list, numpy.ndarray):
......
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