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
<https://rdrr.io/cran/tidygraph/man/create_graphs.html>('bull')  %>%
   activate <https://rdrr.io/cran/tidygraph/man/activate.html>(nodes)  %>%
   mutate <https://rdrr.io/cran/tidygraph/man/reexports.html>(name
<https://rdrr.io/r/base/name.html>  =  letters <https://rdrr.io/r/base/Constants.html>[1:5])
gr2  <-  create_ring <https://rdrr.io/cran/tidygraph/man/create_graphs.html>(10)  %>%
   activate <https://rdrr.io/cran/tidygraph/man/activate.html>(nodes)  %>%
   mutate <https://rdrr.io/cran/tidygraph/man/reexports.html>(name
<https://rdrr.io/r/base/name.html>  =  letters <https://rdrr.io/r/base/Constants.html>[4:13])

gr1  %>%  graph_join <https://rdrr.io/cran/tidygraph/man/graph_join.html>(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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.