I have a network in which I would like to highlight certain edges of node A
:
- directions going out of
A
should be e.g. colored red - directions goint to
A
should be green. - all other edges not connected with node
A
should not be printed at all.
library('igraph')
my_network <- read.table(
header=TRUE,
sep=",",
text="
from,to
A,B
A,C
C,D
D,A
C,A")
set.seed(1234)
my_network_graph <- graph_from_data_frame(my_network)
plot(my_network_graph,
edge.curved= 0.2,
)
So far I can highlight those edges going out of A
.
plot(my_network_graph,
edge.curved= 0.2,
edge.color = c(NA, "red")[1+ (my_network$from == "A")]
)
I would like to have the edges D -> A
and C -> A
in blue in the same plot as with the edges A -> B
and A -> C
(in red).
The list of edges should not be hard-coded. Only A
should be given and the others should be calculated automatically.