Skip to content

Commit

Permalink
Fix #247
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Jan 11, 2024
1 parent 5fc1ba7 commit e010f77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* `GeomEdgeTile` now uses `edge_width` instead of `edge_size` for the border
* Fix a bug in `geom_edge_parallel()` when used with edge labels. Edges are now
correctly offset, though label may still overlap (#227)
* Fix a bug with auto layout on undirected trees (#247)

# ggraph 2.1.0

Expand Down
5 changes: 3 additions & 2 deletions R/tbl_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ prepare_graph <- function(graph, layout, direction = 'out', ...) {
'circlepack',
'partition'
)
if (is_hierarchy || (layout == 'auto' && with_graph(graph, graph_is_tree() || graph_is_forest()))) {
graph <- graph_to_tree(graph, mode = direction)
graph_is_treeish <- with_graph(graph, graph_is_tree() || graph_is_forest())
if (is_hierarchy || (layout == 'auto' && graph_is_treeish)) {
if (!graph_is_treeish) graph <- graph_to_tree(graph, mode = direction)
graph <- permute(graph, match(seq_len(gorder(graph)), order(node_depth(graph, direction))))
}
as_tbl_graph(graph)
Expand Down

0 comments on commit e010f77

Please sign in to comment.