Ejemplo n.º 1
0
        public MetaData Flow()
        {
            MetaData    tracking    = new MetaData();
            Reader      fileReader  = new Reader();
            ReaderStore readerStore = new ReaderStore();

            var pathArray = System.IO.Directory.GetFiles(hardFileName);

            foreach (string path in pathArray)
            {
                var r = fileReader.Read(readerStore.CSV_Reader_Headless, path);
                var s = r.FileValues["H1"][0].Remove(3);
                tracking.ShortestPath.Add(s, new Dictionary <string, string>());

                for (var i = 0; i < r.FileValues["H1"].Count; i++)
                {
                    tracking.ShortestPath[s].Add(r.FileValues["H1"][i].Substring(4), r.FileValues["H2"][i]);
                }
            }
            return(tracking);
        }
Ejemplo n.º 2
0
        string hardFileName = @"..\GL_SP_Demo_Graph\GL_SP_Demo_Graph\Data\airports.csv"; //Will Not Deploy!!!

        public ReferenceData Flow()
        {
            ReferenceData tracking       = new ReferenceData();
            Reader        fileReader     = new Reader();
            ReaderStore   csvReaderStore = new ReaderStore();

            var r = fileReader.Read(csvReaderStore.CSV_Reader_FullHead, hardFileName);

            for (var i = 0; i < r.FileValues[r.Headers[3]].Count; i++)
            {
                if (!tracking.Names.ContainsKey(r.FileValues[r.Headers[3]][i]))
                {
                    tracking.Names.Add(r.FileValues[r.Headers[3]][i], r.FileValues[r.Headers[0]][i]);
                    tracking.City.Add(r.FileValues[r.Headers[3]][i], r.FileValues[r.Headers[1]][i]);
                    tracking.Countries.Add(r.FileValues[r.Headers[3]][i], r.FileValues[r.Headers[2]][i]);
                    tracking.Code3.Add(r.FileValues[r.Headers[3]][i], r.FileValues[r.Headers[3]][i]);
                    tracking.Latitutes.Add(r.FileValues[r.Headers[3]][i], r.FileValues[r.Headers[4]][i]);
                    tracking.Longitudes.Add(r.FileValues[r.Headers[3]][i], r.FileValues[r.Headers[5]][i]);
                }
            }
            return(tracking);
        }
Ejemplo n.º 3
0
        public FlowData Flow()
        {
            FlowData    tracking       = new FlowData();
            Reader      fileReader     = new Reader();
            ReaderStore csvReaderStore = new ReaderStore();

            var r = fileReader.Read(csvReaderStore.CSV_Reader_FullHead, hardFileName);

            for (var i = 0; i < r.FileValues[r.Headers[0]].Count; i++)
            {
                var airline  = r.FileValues[r.Headers[0]][i];
                var outbound = r.FileValues[r.Headers[1]][i];
                var inbound  = r.FileValues[r.Headers[2]][i];

                if (!tracking.Outbound.ContainsKey(outbound))
                {
                    tracking.Outbound.Add(outbound, 1);
                }
                else
                {
                    tracking.Outbound[outbound]++;
                }

                if (!tracking.Inbound.ContainsKey(inbound))
                {
                    tracking.Inbound.Add(inbound, 1);
                }
                else
                {
                    tracking.Inbound[inbound]++;
                }

                if (!tracking.Edges.ContainsKey($"{outbound}|{inbound}"))
                {
                    tracking.Edges.Add($"{outbound}|{inbound}", 1);
                }
                else
                {
                    tracking.Edges[$"{outbound}|{inbound}"]++;
                }
            }

            foreach (var entry in tracking.Inbound)
            {
                if (!tracking.AllNodes.ContainsKey(entry.Key))
                {
                    tracking.AllNodes.Add(entry.Key, entry.Value);
                }
            }

            foreach (var entry in tracking.Outbound)
            {
                if (!tracking.AllNodes.ContainsKey(entry.Key))
                {
                    tracking.AllNodes.Add(entry.Key, entry.Value);
                }
                else
                {
                    tracking.AllNodes[entry.Key] += entry.Value;
                }
            }

            var src = tracking.Outbound.OrderByDescending(x => x.Value);

            tracking.MaxOut = src.First().Key;
            return(tracking);
        }