当前位置: 首页>>代码示例>>C#>>正文


C# AdjacencyGraph.SerializeToGraphML方法代码示例

本文整理汇总了C#中AdjacencyGraph.SerializeToGraphML方法的典型用法代码示例。如果您正苦于以下问题:C# AdjacencyGraph.SerializeToGraphML方法的具体用法?C# AdjacencyGraph.SerializeToGraphML怎么用?C# AdjacencyGraph.SerializeToGraphML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AdjacencyGraph的用法示例。


在下文中一共展示了AdjacencyGraph.SerializeToGraphML方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PersistGraph

        /// <summary>
        /// Saves the graph in the GraphML format in the specified filename
        /// </summary>
        /// <param name="graph">
        /// The graph to persist
        /// </param>
        /// <param name="options">
        /// The core options used to get information about the graph to generate
        /// </param>
        public void PersistGraph(AdjacencyGraph<VisualStudioProject, Edge<VisualStudioProject>> graph, IMsBuilderificCoreOptions options)
        {
            using (var xwriter = XmlWriter.Create(options.GraphFilename))
                graph.SerializeToGraphML<VisualStudioProject, Edge<VisualStudioProject>, AdjacencyGraph<VisualStudioProject, Edge<VisualStudioProject>>>(xwriter, s => s.AssemblyName, e => String.Format("{0} depends on {1}", e.Source.AssemblyName, e.Target.AssemblyName));

        }
开发者ID:Vooban,项目名称:vooban.msbuilderific,代码行数:15,代码来源:ProjectDependencyFinder.cs

示例2: WriteGraph

 private void WriteGraph(string filename, AdjacencyGraph<Node, Edge<Node>> graph)
 {
     var settings = new XmlWriterSettings
     {
         Indent = true,
         IndentChars = "  ",
     };
     using (var writer = XmlWriter.Create(filename, settings))
     {
         graph.SerializeToGraphML<Node, Edge<Node>, AdjacencyGraph<Node, Edge<Node>>>(writer);
     }
 }
开发者ID:yksz,项目名称:samples,代码行数:12,代码来源:GraphForm.cs

示例3: GenerateGraphML

        public static void GenerateGraphML(string fileName)
        {
            var graph = new AdjacencyGraph<XOVertex, XOEdge>();

            var relationshipsSubset = _relationships.Values
                //.Where(e => e.Source.ModuleId == "57$61" && e.Target.ModuleId == "57$61")
                .Where(e => (e.Source.ClassSpec == "Audited" || e.Source.ClassSpec == "Metadata") && (e.Target.ClassSpec == "Audited" || e.Target.ClassSpec == "Metadata"))
                .ToArray();

            foreach (var r in relationshipsSubset)
            {
                if (!graph.ContainsVertex(r.Source))
                    graph.AddVertex(r.Source);

                if (!graph.ContainsVertex(r.Target))
                    graph.AddVertex(r.Target);
            }

            graph.AddEdgeRange(relationshipsSubset);

            int idx = 0;
            foreach (var v in graph.Vertices)
            {
                foreach (var super in v.Superclasses.Select(s => _classes[s]).Where(s => graph.ContainsVertex(s)))
                {
                    string id = string.Concat("inheritance_", idx++);
                    graph.AddEdge(new XOEdge(id, v, super)
                        {
                            Weight = BuildEdgeWeight(v, super),
                            EdgeType = BuildEdgeInheritanceType(v, super),
                            Color = BuildEdgeInheritanceColor(v, super)
                        });
                }
            }

            VertexIdentity<XOVertex> vi = v => v.Id;
            EdgeIdentity<XOVertex, XOEdge> ei = e => e.Id;

            using (XmlWriter xw = XmlWriter.Create(fileName))
            {
                graph.SerializeToGraphML<XOVertex, XOEdge, AdjacencyGraph<XOVertex, XOEdge>>(xw, vi, ei);
            }
        }
开发者ID:gciubotaru,项目名称:workday-hackathon-2015,代码行数:43,代码来源:InputLoader.cs

示例4: SaveGraphToFile

 public static void SaveGraphToFile(AdjacencyGraph<string, Edge<string>> graph, string targetPath)
 {
     // Save the graph
     using (var xwriter = XmlWriter.Create(File.CreateText(targetPath)))
         graph.SerializeToGraphML<string, Edge<string>, AdjacencyGraph<string, Edge<string>>>(xwriter);
 }
开发者ID:igormoochnick,项目名称:AssemblyDependencyGraphVisualizer,代码行数:6,代码来源:AssemblyGraph.cs


注:本文中的AdjacencyGraph.SerializeToGraphML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。