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

concentrate attribute does not work between nodes of different clusters #453

Open
bugriy opened this issue Jan 10, 2022 · 0 comments
Open

Comments

@bugriy
Copy link

bugriy commented Jan 10, 2022

If I render graph without clusters everything goes fine. 2 way connections turn into 2-way arrows according to concentrate = true attribute.

`
ndf1 <-
data.frame(
id = c('a', 'b', 'c','d','e', 'f'),
label = c('a', 'b', 'c','d','e', 'f')#,
# cluster = c('1', '1', '2', '2', '2' , '3' )
)

edf1 <-
data.frame(
from = c( 'f', 'c', 'f', 'a', 'd' ),
to = c( 'c', 'f','a', 'f','e' ))

DiagrammeR::create_graph() %>% 
    add_global_graph_attrs("layout", "dot", "graph") %>%
    add_global_graph_attrs("concentrate", "true", "graph") %>%
    add_global_graph_attrs("rankdir", "TB", "graph") %>%
DiagrammeR::add_nodes_from_table(
    table = ndf1,
    label_col = label) %>% 
DiagrammeR::add_edges_from_table(
    table = edf1,
    from_col = from,
    to_col = to,
    from_to_map = id_external) %>% 
    render_graph()

`
Screenshot 2022-01-10 164323

But as I add clusters - 2-way arrows between nodes of different clusters turn into 2 one-way arrows:

`ndf1 <-
data.frame(
id = c('a', 'b', 'c', 'd', 'e', 'f'),
label = c('a', 'b', 'c', 'd', 'e', 'f'),
cluster = c('1', '1', '2', '2', '2' , '3')
)

edf1 <-
data.frame(from = c('f', 'c', 'f', 'a', 'd'),
to = c('c', 'f', 'a', 'f', 'e'))

DiagrammeR::create_graph() %>%
add_global_graph_attrs("layout", "dot", "graph") %>%
add_global_graph_attrs("concentrate", "true", "graph") %>%
add_global_graph_attrs("rankdir", "TB", "graph") %>%
DiagrammeR::add_nodes_from_table(table = ndf1,
label_col = label) %>%
DiagrammeR::add_edges_from_table(
table = edf1,
from_col = from,
to_col = to,
from_to_map = id_external
) %>%
render_graph()`

Screenshot 2022-01-10 164520

As I checked - inside cluster 2-way arrow works fine. It only breaks between clusters. Looks like no one ever tested concentrate attribute with clusters. Could it be fixed?

`
grViz("
digraph G {

concentrate=true

subgraph cluster1 {
  'c'
  'd' -> 'e'
}

subgraph cluster2 {
  'a' 
  'b'
}

subgraph cluster3 {
  'f' -> 'a'
  'f' -> 'c'
}

 edge[color = black]
                 
'a' -> 'f' 
'e' -> 'd'

}
")
`
Screenshot 2022-01-10 170522

@bugriy bugriy changed the title 2-way arrows not possible between nodes of different clusters concentrate attribute does not work between nodes of different clusters Jan 10, 2022
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

No branches or pull requests

1 participant