The following is a sample Mathematica code, taken from combinatorica.m.

\begin{verbatim}
  << DiscreteMath`Combinatorica`

EdgeColoring[g_Graph] := Module[
  {c = VertexColoring[LineGraph[g]], e = Edges[g], se},

  se = Sort[ Table[{e[[i]], i}, {i, Length[e]}]];
  Map[Last, 
      Sort[Map[Reverse, Table[Prepend[se[[i]], c[[i]]], {i, Length[se]}]]]]
];

\end{verbatim}

