public static void OpenAsDGML <TVertex, TEdge>( #if !NET20 this #endif IVertexAndEdgeListGraph <TVertex, TEdge> graph, string filename) where TEdge : IEdge <TVertex> { Contract.Requires(graph != null); if (filename == null) { filename = "graph.dgml"; } #if NET20 WriteXml(ToDirectedGraphML(graph), filename); #else graph.ToDirectedGraphML().WriteXml(filename); #endif if (Debugger.IsAttached) { Process.Start(filename); } }
public static void OutputToDgml(string output, IVertexAndEdgeListGraph<AssemblyVertex, EquatableEdge<AssemblyVertex>> graph) { graph.ToDirectedGraphML(graph.GetVertexIdentity(), graph.GetEdgeIdentity(), (n, d) => { d.Label = n.AssemblyName.Name + " " + n.AssemblyName.Version; if (!n.Exists) d.Background = "Red"; if (!n.Exists && n.Excluded) d.Background = "Yellow"; }, (e, l) => l.Label = "").WriteXml(output); }
/// <summary> /// Saves and opens the given <paramref name="graph"/> as DGML. /// </summary> /// <typeparam name="TVertex">Vertex type.</typeparam> /// <typeparam name="TEdge">Edge type.</typeparam> /// <param name="graph">Graph to open.</param> /// <param name="filePath">Path to the file to save.</param> public static void OpenAsDGML <TVertex, TEdge>( [NotNull] this IVertexAndEdgeListGraph <TVertex, TEdge> graph, [CanBeNull] string filePath) where TEdge : IEdge <TVertex> { if (graph is null) { throw new ArgumentNullException(nameof(graph)); } if (filePath is null) { filePath = "graph.DGML"; } graph.ToDirectedGraphML().WriteXml(filePath); if (Debugger.IsAttached) { Process.Start(filePath); } }