Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/16/14 15:37:23 (10 years ago)
Author:
bburlacu
Message:

#1772: Added ExportDot method to DirectedGraph. Worked on the BottomUpDistanceCalculator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/DirectedGraph.cs

    r10936 r11021  
    2424using System.Drawing;
    2525using System.Linq;
     26using System.Text;
    2627using HeuristicLab.Common;
    2728using HeuristicLab.Core;
     
    178179      get { return Common.Resources.VSImageLibrary.Graph; }
    179180    }
     181
     182    public string ExportDot() {
     183      var sb = new StringBuilder();
     184      sb.Append("digraph g {");
     185      foreach (var v in Vertices) {
     186        sb.Append("\"" + v.Id + "\" [label=\"" + v.Label + "\"];" + Environment.NewLine);
     187      }
     188
     189      foreach (var v in Vertices) {
     190        foreach (var c in v.OutArcs.Select(x => x.Target)) {
     191          sb.Append("\"" + v.Id + "\" -> \"" + c.Id + "\"" + Environment.NewLine);
     192        }
     193      }
     194      sb.Append("}");
     195      return sb.ToString();
     196    }
    180197  }
    181198}
Note: See TracChangeset for help on using the changeset viewer.