コード例 #1
0
 public void Initialize()
 {
     writer = new GraphXML();
     IdGenerator.SetNodeIdStartFrom(0);
     IdGenerator.SetEdgeIdStartFrom(0);
     emptyGraphPath      = "empty graph.xml";
     graph1NodePath      = "graph.xml";
     graph1Path          = "graph1.xml";
     graph2Path          = "graph2.xml";
     graphExoticNodePath = "exotic graph.xml";
     extendableGraphPath = "extendable graph.xml";
 }
コード例 #2
0
        public void TestObserve()
        {
            GraphXML xgraph = new GraphXML();
            var      g      = xgraph.Read("C:\\Users\\user\\Downloads\\multiple_paths.xml");

            observers = g.AllNodes.Values.Where(node => node.IsObserver).ToList();
            AllPaths algorithm = new AllPaths();
            var      results   = co.Observe(g, observers, Tuple.Create("cost", Constraint <IEdge> .Default), algorithm);

            foreach (var pair in results)
            {
                var from = pair.Key.From;
                var to   = pair.Key.To;

                var obsereveds   = pair.Value.Item1;
                var unobsserveds = pair.Value.Item2;
            }
        }
コード例 #3
0
ファイル: ClusterHelper.cs プロジェクト: nhannhan159/PAT
        //hàm xu?t file XML t?ng c?m tru?c và sau khi x? lý, có luôn c? file full sau khi x? lý
        private void saveClusters(List<Sensor> listSensors, List<Link> listLinks, int NoCluster, int state, List<String> Pathfull)
        {
            do
            {
                if (state == 1)
                    tmpName = CURRENT_PATH + BEFORE_FOLDER + @"\Before_cluster " + NoCluster.ToString() + ".kwsn";
                else if (state == 2)
                    tmpName = CURRENT_PATH + AFTER_FOLDER + @"\After_cluster " + NoCluster.ToString() + ".kwsn";
                else if (state == 3)
                    tmpName = CURRENT_PATH + @"\full_After_cluster" + ".kwsn";
                else
                {
                    MessageBox.Show("Cannot write file .kwsn", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                XmlTextWriter writer = new XmlTextWriter(tmpName, System.Text.Encoding.UTF8);
                writer.Formatting = Formatting.Indented;
                writer.Indentation = 2;
                GraphXML graph = new GraphXML();
                graph.createXML(writer, listSensors, listLinks, Pathfull, listParameterNetwork);
                writer.Close();

                // Only open last Kwsn
                if (state == 3)
                    mClusterListener.onOpenFile(tmpName);
            } while (false);
        }
コード例 #4
0
 public void TestConstructor()
 {
     writer = new GraphXML();
 }