Пример #1
0
 private static void PrintMap(Map map)
 {
     foreach (var edge in map) {
         Console.WriteLine("Edge: {0}, weight:{1}", edge, edge.Weight);
     }
     Console.WriteLine();
 }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == DialogResult.OK) {
                if (dialog.FileName == null) {
                    return;
                }

                try {
                    _path = dialog.FileName;
                    var source = new ExcelMapDataSource(_path);
                    _map = source.ImportMap();

                    lblFilePath.Text = _path;
                    btnInDegree.Enabled = true;
                    btnOutDegree.Enabled = true;
                    btnAverageDegree.Enabled = true;
                    btnClustering.Enabled = true;
                    btnAveragePath.Enabled = true;
                    btnExport.Enabled = true;
                } catch {
                    MessageBox.Show("未知文件.");
                }
            }
        }
Пример #3
0
        public override Map ImportMap()
        {
            var rawData = ReadAll(_excelPath);

            var map = new Map();
            foreach (var line in rawData) {
                var edge = GenerateEdge(line);
                map.Add(edge);
            }

            return map;
        }
Пример #4
0
        static void Main(string[] args)
        {
            var map = new Map();

            var v1 = new Vertex { VertexName = "v1" };
            var v2 = new Vertex { VertexName = "v2" };
            var v3 = new Vertex { VertexName = "v3" };
            var v4 = new Vertex { VertexName = "v4" };
            var v5 = new Vertex { VertexName = "v5" };
            var v6 = new Vertex { VertexName = "v6" };
            var v7 = new Vertex { VertexName = "v7" };

            var e12 = new Edge(v1, v2, 2);
            var e23 = new Edge(v2, v3, 1);
            var e15 = new Edge(v1, v5, 4);
            var e56 = new Edge(v5, v6, 3);
            var e54 = new Edge(v5, v4, 3);
            var e64 = new Edge(v6, v4, 1);
            var e27 = new Edge(v2, v7, 2);
            var e74 = new Edge(v7, v4, 2);

            map.Add(e12);
            map.Add(e23);
            map.Add(e15);
            map.Add(e56);
            map.Add(e54);
            map.Add(e64);
            map.Add(e27);
            map.Add(e74);

            PrintMap(map);

            Console.WriteLine("Dijkstra start from {0}", v1);
            var dijkstra = new Dijkstra(map, v1);
            var result = dijkstra.ExecuteDijkstra();
            PrintResult(result);

            Console.ReadLine();
        }
Пример #5
0
 public ParameterCalculater(Map map)
 {
     _map = map;
 }
Пример #6
0
 public ClusteringCalculater(Map map)
     : base(map)
 {
 }
 public AveragePathValueCalculater(Map map)
     : base(map)
 {
 }
Пример #8
0
 public DegreeCalculater(Map map)
     : base(map)
 {
 }
Пример #9
0
 public PajekTargetFormater(Map map)
 {
     _map = map;
 }