From https://mathematica.stackexchange.com/a/109436/70384 , I modified the code to display the bipartite graph I want and how do I label my edge with the edge weight by manually specifying it? I use EdgeLabels -> Automatic
which is not what I want.
ClearAll["Global`*"]
colsNames = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
attrsNames = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
len1 = 13;
len2 = 13;
keys1 = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L",
"M"};
keys2 = {"T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10",
"T11", "T12", "T13"};
step = 15;
lis1 = Table[{y1, 0}, {y1, step, step*len1, step}];
lis2 = Table[{y1, 30}, {y1, step, step*len2, step}];
vlabels =
Join[MapThread[#1 ->
Placed[{Style[#, 16, Bold], Style[#2, 14, Bold]}, {Center,
Below}] &, {keys1, colsNames}],
MapThread[#1 ->
Placed[{Style[#, 16, Bold], Style[#2, 14, Bold]}, {Center,
Above}] &, {keys2, attrsNames}]];
Options[bpGraph] = {VertexLabelStyle -> Large, VertexStyle -> Red,
EdgeStyle -> Thick, VertexSize -> {"Scaled", .06},
ImageSize -> Medium, VertexCoordinates -> Automatic,
VertexLabels -> Placed["Name", Center], EdgeLabels -> Automatic};
bpGraph[nds_, edgs_, opts : OptionsPattern[{bpGraph, Graph}]] :=
Graph[nds, edgs,
Sequence @@
FilterRules[Join[{opts}, Options[bpGraph]], Options[Graph]]]
SetOptions[bpGraph, VertexCoordinates -> Join[lis1, lis2],
VertexLabels -> vlabels];
after = bpGraph[
Join[keys1, keys2], {"A" -> "T12" , "B" -> "T3", "C" -> "T5",
"D" -> "T9", "E" -> "T5", "F" -> "T6", "G" -> "T7", "H" -> "T8",
"I" -> "T9", "J" -> "T10", "K" -> "T4", "L" -> "T12",
"M" -> "T13"}]
This is the modified source code. I would like to specify my edge in this way, for example, EdgeLabels -> {1 <-> 2 -> 45}
where 45 is my weight. I don't know how to type the symbol connecting 1 and 2, usually I just copy and paste the middle symbol.