Skip to content

Commit

Permalink
R: fix print.igraph.es if there are vertex names
Browse files Browse the repository at this point in the history
Just broke it with ends(..., names = TRUE).
  • Loading branch information
gaborcsardi committed Oct 19, 2014
1 parent 7741fe3 commit f24d8c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion interfaces/R/igraph/R/iterators.R
Expand Up @@ -458,7 +458,7 @@ print.igraph.es <- function(x, ...) {
arrow <- "--"
}
x <- as.numeric(x)
el <- ends(graph, x)
el <- ends(graph, x, names = FALSE)
if ("name" %in% vertex_attr_names(graph)) {
el <- matrix(V(graph)$name[el], ncol=2)
}
Expand Down
7 changes: 7 additions & 0 deletions interfaces/R/igraph/inst/tests/test_print.R
Expand Up @@ -50,3 +50,10 @@ test_that("print.igraph works", {

igraph_options(print.full=FALSE)
})

test_that("print.igraph.es uses vertex names", {

g <- make_directed_graph(c("A", "B"))
expect_output(print(E(g)), "A\\s->\\sB")

})

0 comments on commit f24d8c0

Please sign in to comment.