Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Color the edges of a graph so no edges incident to each other have the same color
ResourceFunction["ColorGraphEdges"][graph] colors the edges of graph so no edges incident to each other have the same color. | |
ResourceFunction["ColorGraphEdges"][graph, colors] uses the color function colors. |
Color the edges of the Petersen graph:
In[1]:= | ![]() |
Out[1]= | ![]() |
Use a different coloring list with ColorData:
In[2]:= | ![]() |
Out[2]= | ![]() |
Color the edges of the skeleton of the Csaszar polyhedron:
In[3]:= | ![]() |
Out[3]= | ![]() |
Find edge colorings for a large random graph:
In[5]:= | ![]() |
Out[5]= | ![]() |
Color the Hoffman-Singleton graph with seven colors:
In[6]:= | ![]() |
Out[6]= | ![]() |
Use ColorGraphVertices to color the vertices instead:
In[7]:= | ![]() |
Out[7]= | ![]() |
This colors the edges:
In[8]:= | ![]() |
Out[8]= | ![]() |
The number of colors needed for the edges is given by EdgeChromaticNumber:
In[9]:= | ![]() |
Out[9]= | ![]() |
Verify the count with FindEdgeColoring:
In[10]:= | ![]() |
Out[10]= | ![]() |
When the function FindEdgeColoring cannot find an edge coloring, ColorGraphEdges will not color the graph:
In[11]:= | ![]() |
Out[11]= | ![]() |
Wolfram Language 12.3 (May 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License