Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as_tbl_graph doesn't return a tbl_graph for data.tree::Node #108

Closed
oliverbeagley opened this issue Oct 23, 2019 · 0 comments · Fixed by #109
Closed

as_tbl_graph doesn't return a tbl_graph for data.tree::Node #108

oliverbeagley opened this issue Oct 23, 2019 · 0 comments · Fixed by #109

Comments

@oliverbeagley
Copy link
Contributor

Looks like the method for Node doesn't re-class after converting to igraph https://github.com/thomasp85/tidygraph/blob/master/R/data_tree.R#L8

library(data.tree)
library(tidygraph)
#> 
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#> 
#>     filter

data(acme)

gr <- as_tbl_graph(acme)
gr
#> IGRAPH 5e514fb DN-- 11 10 -- 
#> + attr: name (v/c)
#> + edges from 5e514fb (vertex names):
#>  [1] Acme Inc. ->Accounting              
#>  [2] Acme Inc. ->Research                
#>  [3] Acme Inc. ->IT                      
#>  [4] Accounting->New Software            
#>  [5] Accounting->New Accounting Standards
#>  [6] Research  ->New Product Line        
#>  [7] Research  ->New Labs                
#>  [8] IT        ->Outsource               
#> + ... omitted several edges

as_tbl_graph(gr)
#> # A tbl_graph: 11 nodes and 10 edges
#> #
#> # A rooted tree
#> #
#> # Node Data: 11 x 1 (active)
#>   name                    
#>   <chr>                   
#> 1 Acme Inc.               
#> 2 Accounting              
#> 3 New Software            
#> 4 New Accounting Standards
#> 5 Research                
#> 6 New Product Line        
#> # … with 5 more rows
#> #
#> # Edge Data: 10 x 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     1     5
#> 3     1     8
#> # … with 7 more rows

Created on 2019-10-23 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant