title: How to draw a weighted graph on latex?
body: <p>I need to draw a weighted graph using LaTeX but I don't know how to put the numbers on the edges. The numbers are like the costs of each edge.
  The graph can be drawn by this:</p>
  
  <pre><code>\begin{tikzpicture}
  \draw 
  (1, 1) node[circle, black, draw](m){M}
  (1, 3) node[circle, black, draw](i){I}
  (1, 5) node[circle, black, draw](e){E}
  (1, 7) node[circle, black, draw](a){A}
  (3, 1) node[circle, black, draw](n){N}
  (3, 3) node[circle, black, draw](j){J}
  (3, 5) node[circle, black, draw](f){F}
  (3, 7) node[circle, black, draw](b){B}
  (5, 1) node[circle, black, draw](o){O}
  (5, 3) node[circle, black, draw](k){K}
  (5, 5) node[circle, black, draw](g){G}
  (5, 7) node[circle, black, draw](c){C}
  (7, 1) node[circle, black, draw](p){P}
  (7, 3) node[circle, black, draw](l){L}
  (7, 5) node[circle, black, draw](h){H}
  (7, 7) node[circle, black, draw](d){D};
  
  \draw[-] (a) -- (b);
  \draw[-] (b) -- (c);
  \draw[-] (c) -- (d);
  \draw[-] (f) -- (g);
  \draw[-] (g) -- (h);
  \draw[-] (i) -- (j);
  \draw[-] (j) -- (k);
  \draw[-] (k) -- (l);
  \draw[-] (m) -- (n);
  \draw[-] (n) -- (o);
  \draw[-] (o) -- (p);
  \draw[-] (a) -- (e);
  \draw[-] (b) -- (f);
  \draw[-] (c) -- (g);
  \draw[-] (d) -- (h);
  \draw[-] (e) -- (i);
  \draw[-] (f) -- (j);
  \draw[-] (g) -- (k);
  \draw[-] (i) -- (m);
  \draw[-] (j) -- (n);
  \draw[-] (k) -- (o);
  \draw[-] (l) -- (p);
  
  \end{tikzpicture}
  </code></pre>