private void drawEdge2(int x0, int y0, int x1, int y1, int cost, int flow, Color color) {
        Graphics2D g2d = (Graphics2D) g;

        g2d.setColor(color);
        if (color.equals(Color.RED)) {
            g2d.setStroke(new BasicStroke(3));
        } else {
            g2d.setStroke(new BasicStroke(1));
        }

        x0 = x0 * SQUARE_SIZE + SQUARE_SIZE / 2;
        y0 = y0 * SQUARE_SIZE + SQUARE_SIZE / 2;
        x1 = x1 * SQUARE_SIZE + SQUARE_SIZE / 2;
        y1 = y1 * SQUARE_SIZE + SQUARE_SIZE / 2;

        int xx = (x0 + x1) / 2;
        int yy = (y0 + y1) / 2;

        g2d.drawLine(x0, y0, x1, y1);
        int fontSize = 20;
        g2d.setFont(new Font("TimesRoman", Font.PLAIN, fontSize));

        String s = "";
        if (showEdgeCost) {
            s = String.valueOf(cost);
        }
        if (showEdgeFlow) {
            if (showEdgeCost) {
                s = flow + "/" + cost;
            } else {
                s = String.valueOf(flow);
            }
        }

        g2d.drawString(s, xx, yy);
    }