Commit 1d3d69ed authored by Facundo Muñoz's avatar Facundo Muñoz ®️
Browse files

read_network(): interpret edge attribute as weight

parent eefcdbcd
......@@ -112,5 +112,12 @@ must be respected:",
ans <- igraph::graph_from_data_frame(e_list, vertices = v_coord, directed = TRUE)
## If there are edge attributes, it must be only one, and must be
## the weight.
if((natt <- length(edge_attr_names(ans))) > 0) {
stopifnot(identical(natt, 1L))
names(edge.attributes(ans)) <- "weight"
}
return(ans)
}
Supports Markdown
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