Exemplo n.º 1
0
        internal override GraphMapData ImportData(string jsonData)
        {
            TracWrapper  tracWrapper = GetTracWrapper(jsonData);
            GraphMapData graph       = TracGraphDataFormat.JsonToGraph(tracWrapper);

            return(graph);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the proper graph format using the specified format
        /// </summary>
        /// <param name="format">Graph format</param>
        /// <returns>An intialized concrete GraphDataFormatBase</returns>
        /// <exception cref="InvalidOperationException">Thrown if the specified format is invalid</exception>
        private static GraphDataFormatBase InitializeGraphFormat(string format)
        {
            GraphDataFormatBase graphFormat;

            switch (format.ToLower())
            {
                case "graphml":
                    graphFormat = new GraphMLGraphDataFormat();
                    break;

                case "trac":
                    graphFormat = new TracGraphDataFormat();
                    break;

                case "anb":
                    graphFormat = new AnbGraphDataFormat();
                    break;
                default:
                    throw new InvalidOperationException("Unknown graph format");

            }

            return graphFormat;
        }