package com.github.ferstl.depgraph.dependency;

import com.github.ferstl.depgraph.graph.EdgeRenderer;

import static com.github.ferstl.depgraph.dependency.VersionAbbreviator.abbreviateVersion;

public class GmlDependencyEdgeRenderer implements EdgeRenderer<DependencyNode> {

  private final boolean renderVersion;

  public GmlDependencyEdgeRenderer(boolean renderVersion) {
    this.renderVersion = renderVersion;
  }

  @Override
  public String render(DependencyNode from, DependencyNode to) {
    NodeResolution resolution = to.getResolution();
    StringBuilder builder = new StringBuilder();

    if (resolution == NodeResolution.OMITTED_FOR_CONFLICT) {
      if (this.renderVersion) {
        builder.append("label \"").append(abbreviateVersion(to.getArtifact().getVersion())).append("\"");
      }

      addStyleAttributes(builder, "dashed", "#FF0000");

    } else if (resolution == NodeResolution.OMITTED_FOR_DUPLICATE) {
      addStyleAttributes(builder, "dotted", "");
    }

    return builder.toString();
  }

  private static void addStyleAttributes(StringBuilder builder, String edgeStyle, String color) {
    builder.append("\n")
        .append("graphics\n")
        .append("[\n")
        .append("style \"").append(edgeStyle).append("\"").append("\n")
        .append("targetArrow \"").append("standard").append("\"");

    if (!color.isEmpty()) {
      builder.append("\n")
          .append("fill \"").append(color).append("\"");
    }

    builder.append("\n")
        .append("]");
  }
}

@@ -650,24 +650,51 @@
 CONFLICT) %7B%0A
+      String version = %22%22;%0A
       if (th
@@ -725,42 +725,18 @@
     
-builder.append(%22label %5C%22%22).append(
+version = 
 abbr
@@ -779,30 +779,16 @@
 rsion())
-).append(%22%5C%22%22)
 ;%0A      
@@ -823,16 +823,25 @@
 builder,
+ version,
  %22dashed
@@ -958,16 +958,20 @@
 builder,
+ %22%22,
  %22dotted
@@ -1084,16 +1084,30 @@
 builder,
+ String label,
  String 
@@ -1129,24 +1129,120 @@
 ng color) %7B%0A
+    if (!label.isEmpty()) %7B%0A      builder.append(%22label %5C%22%22).append(label).append(%22%5C%22%22);%0A    %7D%0A%0A
     builder.

Add label in addStyleAttributes() method