예제 #1
0
        /// <summary>
        ///     Write the data in a Graph to a JSON OutputStream. All keys are written to JSON.
        /// </summary>
        /// <param name="graph">the graph to serialize to JSON</param>
        /// <param name="filename">the JSON file to write the Graph data to</param>
        /// <param name="mode">determines the format of the GraphSON</param>
        public static void OutputGraph(IGraph graph, string filename, GraphSonMode mode)
        {
            if (graph == null)
            {
                throw new ArgumentNullException(nameof(graph));
            }
            if (string.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentNullException(nameof(filename));
            }

            var writer = new GraphSonWriter(graph);

            writer.OutputGraph(filename, null, null, mode);
        }
예제 #2
0
        /// <summary>
        ///     Write the data in a Graph to a JSON OutputStream. All keys are written to JSON.
        /// </summary>
        /// <param name="graph">the graph to serialize to JSON</param>
        /// <param name="jsonOutputStream">the JSON OutputStream to write the Graph data to</param>
        /// <param name="mode">determines the format of the GraphSON</param>
        public static void OutputGraph(IGraph graph, Stream jsonOutputStream, GraphSonMode mode)
        {
            if (graph == null)
            {
                throw new ArgumentNullException(nameof(graph));
            }
            if (jsonOutputStream == null)
            {
                throw new ArgumentNullException(nameof(jsonOutputStream));
            }

            var writer = new GraphSonWriter(graph);

            writer.OutputGraph(jsonOutputStream, null, null, mode);
        }
예제 #3
0
        /// <summary>
        ///     Write the data in a Graph to a JSON OutputStream.
        /// </summary>
        /// <param name="graph">the graph to serialize to JSON</param>
        /// <param name="filename">the JSON file to write the Graph data to</param>
        /// <param name="vertexPropertyKeys">the keys of the vertex elements to write to JSON</param>
        /// <param name="edgePropertyKeys">the keys of the edge elements to write to JSON</param>
        /// <param name="mode">determines the format of the GraphSON</param>
        public static void OutputGraph(IGraph graph, string filename,
                                       IEnumerable <string> vertexPropertyKeys, IEnumerable <string> edgePropertyKeys,
                                       GraphSonMode mode)
        {
            if (graph == null)
            {
                throw new ArgumentNullException(nameof(graph));
            }
            if (string.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentNullException(nameof(filename));
            }

            var writer = new GraphSonWriter(graph);

            writer.OutputGraph(filename, vertexPropertyKeys, edgePropertyKeys, mode);
        }
예제 #4
0
        /// <summary>
        ///     Write the data in a Graph to a JSON OutputStream.
        /// </summary>
        /// <param name="graph">the graph to serialize to JSON</param>
        /// <param name="jsonOutputStream">the JSON OutputStream to write the Graph data to</param>
        /// <param name="vertexPropertyKeys">the keys of the vertex elements to write to JSON</param>
        /// <param name="edgePropertyKeys">the keys of the edge elements to write to JSON</param>
        /// <param name="mode">determines the format of the GraphSON</param>
        public static void OutputGraph(IGraph graph, Stream jsonOutputStream,
                                       IEnumerable <string> vertexPropertyKeys, IEnumerable <string> edgePropertyKeys,
                                       GraphSonMode mode)
        {
            if (graph == null)
            {
                throw new ArgumentNullException(nameof(graph));
            }
            if (jsonOutputStream == null)
            {
                throw new ArgumentNullException(nameof(jsonOutputStream));
            }

            var writer = new GraphSonWriter(graph);

            writer.OutputGraph(jsonOutputStream, vertexPropertyKeys, edgePropertyKeys, mode);
        }