static void PrintTopologyUnit(Unit.UnitBase unit, StringBuilder builder, Dictionary <Unit.UnitBase, int> dict) { foreach (var item in unit.In.Select(x => x.FromUnit)) { if (!dict.ContainsKey(item)) { dict[item] = dict.Count; PrintLabel(item, builder, dict); PrintTopologyUnit(item, builder, dict); } builder.AppendFormat("\t{0}_{2} -> {1}_{3};\n", item, unit, dict[item], dict[unit]); } }
static void PrintLabel(Unit.UnitBase unit, StringBuilder builder, Dictionary <Unit.UnitBase, int> dict) { builder.AppendFormat("\t{0}_{1}[label=\"{0}\"];\n", unit, dict[unit]); }