I working in mathematica and have a graph that every vertex is in a different color, i want to coloring the edges. for example: if two vertex in the same color, the edge will be in some color, and so on for all the edges with this property.
In general, how can i get the color of vertex?
Thanks!
here is how to generate the graph, assuming you have access to the input:
g = Select[
Union@Table[
RandomInteger[{1, 10}] -> RandomInteger[{1, 10}], {35}],
! Equal @@ # &];
colors = Table[
i -> RandomChoice[ {Red, Blue, Green, Orange} ] ,
{i, (Union@Flatten[List @@@ g])}];
Graph[g,
VertexStyle -> colors,
EdgeStyle -> ((# -> (#[[1]]/.colors )) & /@
Select[g,(#[[1]]/.colors) == (#[[2]]/.colors ) & ]) ]
If you only have the graph object and need to extract the style data that will be a bit of a chore.