示例#1
0
        /// <summary>
        ///     Write the data in a Graph to a GraphML OutputStream.
        /// </summary>
        /// <param name="graph">the Graph to pull the data from</param>
        /// <param name="graphMlOutputStream">the GraphML OutputStream to write the Graph data to</param>
        /// <param name="vertexKeyTypes">a IDictionary&lt;string, string> of the data types of the vertex keys</param>
        /// <param name="edgeKeyTypes">a IDictionary&lt;string, string> of the data types of the edge keys</param>
        public static void OutputGraph(IGraph graph, Stream graphMlOutputStream,
                                       Dictionary <string, string> vertexKeyTypes,
                                       Dictionary <string, string> edgeKeyTypes)
        {
            var writer = new GraphMlWriter(graph);

            writer.SetVertexKeyTypes(vertexKeyTypes);
            writer.SetEdgeKeyTypes(edgeKeyTypes);
            writer.OutputGraph(graphMlOutputStream);
        }
示例#2
0
        /// <summary>
        ///     Write the data in a Graph to a GraphML file.
        /// </summary>
        /// <param name="graph">the Graph to pull the data from</param>
        /// <param name="filename">the name of the file write the Graph data (as GraphML) to</param>
        /// <param name="vertexKeyTypes">a IDictionary&lt;string, string> of the data types of the vertex keys</param>
        /// <param name="edgeKeyTypes">a IDictionary&lt;string, string> of the data types of the edge keys</param>
        public static void OutputGraph(IGraph graph, string filename, Dictionary <string, string> vertexKeyTypes,
                                       Dictionary <string, string> edgeKeyTypes)
        {
            if (string.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentNullException(nameof(filename));
            }

            var writer = new GraphMlWriter(graph);

            writer.SetVertexKeyTypes(vertexKeyTypes);
            writer.SetEdgeKeyTypes(edgeKeyTypes);
            writer.OutputGraph(filename);
        }