Beispiel #1
0
        public static DirectedGraph ToDirectedGraphML <TVertex, TEdge>(
            [NotNull] this IVertexAndEdgeListGraph <TVertex, TEdge> visitedGraph,
            [NotNull] Func <TVertex, GraphColor> vertexColors)
            where TEdge : IEdge <TVertex>
        {
            return(ToDirectedGraphML(
                       visitedGraph,
                       visitedGraph.GetVertexIdentity(),
                       visitedGraph.GetEdgeIdentity(),
                       (vertex, node) =>
            {
                GraphColor color = vertexColors(vertex);
                switch (color)
                {
                case GraphColor.Black:
                    node.Background = "Black";
                    break;

                case GraphColor.Gray:
                    node.Background = "LightGray";
                    break;

                case GraphColor.White:
                    node.Background = "White";
                    break;
                }
            },
                       null));
        }
Beispiel #2
0
        public static DirectedGraph ToDirectedGraphML <TVertex, TEdge>(
            [NotNull] this IVertexAndEdgeListGraph <TVertex, TEdge> graph,
            [NotNull] Func <TVertex, GraphColor> verticesColors)
            where TEdge : IEdge <TVertex>
        {
            if (verticesColors is null)
            {
                throw new ArgumentNullException(nameof(verticesColors));
            }

            return(ToDirectedGraphML(
                       graph,
                       graph.GetVertexIdentity(),
                       graph.GetEdgeIdentity(),
                       (vertex, node) =>
            {
                GraphColor color = verticesColors(vertex);
                switch (color)
                {
                case GraphColor.Black:
                    node.Background = "Black";
                    break;

                case GraphColor.Gray:
                    node.Background = "LightGray";
                    break;

                case GraphColor.White:
                    node.Background = "White";
                    break;
                }
            },
                       null));
        }
Beispiel #3
0
 public static DirectedGraph ToDirectedGraphML <TVertex, TEdge>([NotNull] this IVertexAndEdgeListGraph <TVertex, TEdge> visitedGraph)
     where TEdge : IEdge <TVertex>
 {
     return(ToDirectedGraphML(
                visitedGraph,
                visitedGraph.GetVertexIdentity(),
                visitedGraph.GetEdgeIdentity()));
 }
 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);
 }