Ejemplo n.º 1
0
 /// <summary>
 ///     Saves the given <see cref="IInformationTree{TProgram}" /> to an image file.
 /// </summary>
 /// <typeparam name="TProgram">The type of program.</typeparam>
 /// <param name="tree">The information tree to be saved.</param>
 /// <param name="basePath">The path in which to save the given information tree</param>
 /// <param name="fileName">The name of the image file to be saved (without extension)</param>
 /// <param name="imageType">The type of image file in which to save the tree.</param>
 /// <param name="timeout">The maximum time to wait for Graphviz to create the image file.</param>
 /// <returns>The path to file where the tree image file was saved.</returns>
 public static string ToGraphvizFile <TProgram>(
     this IInformationTree <TProgram> tree, string basePath, string fileName,
     GraphvizImageType imageType = GRAPHVIZ_IMAGE_TYPE, int timeout = GRAPHVIZ_TIMEOUT_MS)
     where TProgram : ITreeProgram
 {
     return(tree.RootNode.ToGraphvizFile(
                basePath, fileName, OnFormatInfoVertex, OnFormatInfoEdge, imageType, timeout));
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     Saves the given <see cref="IInformationTree{TProgram}" /> to a d3.js tree file.
 /// </summary>
 /// <typeparam name="TProgram">The type of program.</typeparam>
 /// <param name="tree">The information tree to be saved.</param>
 /// <param name="filePath">The path of the file in which to save the given information tree.</param>
 /// <param name="formatting">The formatting to be used to write to the json file.</param>
 public static void ToD3JsonFile <TProgram>(
     this IInformationTree <TProgram> tree, string filePath, Formatting formatting = Formatting.None)
     where TProgram : ITreeProgram
 {
     ToD3JsonFile(tree.RootNode, filePath, formatting);
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     Gets the degree of fullness of the tree.
 /// </summary>
 /// <returns>The degree of fullness of the tree.</returns>
 public static double GetFullness <TProgram>(this IInformationTree <TProgram> tree) where TProgram : ITreeProgram
 {
     return(1d / tree.RootNode.Value *
            tree.RootNode.Children.Sum(child => GetFullness((IInformationTreeNode)child, 0)));
 }