/// <summary>
        ///     Pipe the data from one graph to another graph.
        /// </summary>
        /// <param name="fromGraph">the graph to take data from</param>
        /// <param name="toGraph">the graph to take data to</param>
        public static void MigrateGraph(IGraph fromGraph, IGraph toGraph)
        {
            if (fromGraph == null)
            {
                throw new ArgumentNullException(nameof(fromGraph));
            }
            if (toGraph == null)
            {
                throw new ArgumentNullException(nameof(toGraph));
            }

            const int pipeSize = 1024;
            var       outPipe  = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable, pipeSize);
            {
                using (var inPipe = new AnonymousPipeClientStream(PipeDirection.In, outPipe.ClientSafePipeHandle))
                {
                    Task.Factory.StartNew(() =>
                    {
                        GraphMlWriter.OutputGraph(fromGraph, outPipe);
                        outPipe.Flush();
                        outPipe.Close();
                    });

                    GraphMlReader.InputGraph(toGraph, inPipe);
                }
            }
        }
Beispiel #2
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);
        }
Beispiel #3
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>
        public static void OutputGraph(IGraph graph, string filename)
        {
            if (string.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentNullException(nameof(filename));
            }

            var writer = new GraphMlWriter(graph);

            writer.OutputGraph(filename);
        }
Beispiel #4
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);
        }
Beispiel #5
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>
        public static void OutputGraph(IGraph graph, Stream graphMlOutputStream)
        {
            var writer = new GraphMlWriter(graph);

            writer.OutputGraph(graphMlOutputStream);
        }