Identifying tidygraph subgraphs

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Identifying tidygraph subgraphs

Wolfgang Grond
Dear all,

imagine the following situation:

I want to create a tidygraph consisting of several subgraphs like in
this example:

gr1  <-  create_notable
<>('bull')  %>%
   activate <>(nodes)  %>%
   mutate <>(name
<>  =  letters <>[1:5])
gr2  <-  create_ring <>(10)  %>%
   activate <>(nodes)  %>%
   mutate <>(name
<>  =  letters <>[4:13])

gr1  %>%  graph_join <>(gr2)
when the merged graph is plotted with ggraph afterwards, I would like to
identify the former graphs gr1 and gr2 by their node color, so that it
is possible to see which node originates from which source. The result
will be as follows: nodes a, b, c have i. e. color blue as they
originate from gr1, nodes f, g, h, i, j, k, l, m have i. e. color red as
they originate from gr2, nodes d, e either have color blue or color red
(depending in which sequence the graphs are joined), or nodes d. e have
a third color, i. e. green as the belong to both graphs How can this be
done? Thanks in advance. Wolfgang Grond

        [[alternative HTML version deleted]]

[hidden email] mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.