public static void DoTest()
        {
            compareGraph = new UndirectedDenseGraph <ComparableTuple>(numClusters * vertexPerCluster);
            MakeGraph(compareGraph);

            testGraph = new CliqueGraph <ComparableTuple>(compareGraph);
            // ICollection<ComparableTuple> component = testGraph.GetConnectedComponent(new ComparableTuple(0, 0));
            // DataStructures.Lists.DLinkedList<ComparableTuple> neighbor = testGraph.Neighbours(new ComparableTuple(0, 0));

            testGraph.RemoveEdge(new ComparableTuple(0, 0), new ComparableTuple(1, 0));

            IGraph <CliqueGraph <ComparableTuple> .Clique> dualGraph = testGraph.buildDualGraph();

            foreach (var x in dualGraph.Vertices)
            {
                foreach (var y in dualGraph.Neighbours(x))
                {
                    System.Diagnostics.Debug.WriteLine(string.Format("{0}-{1}", x, y));
                }
            }

            // CliqueGraph.Edges test
            foreach (var edge in testGraph.Edges)
            {
                //System.Diagnostics.Debug.WriteLine(string.Format("{0} -> {1}\t", edge.Source, edge.Destination));
            }

            foreach (var edge in testGraph.OutgoingEdges(new ComparableTuple(0, 0)))
            {
                System.Diagnostics.Debug.WriteLine(string.Format("{0} -> {1}\t", edge.Source, edge.Destination));
            }
        }
Пример #2
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            string result = string.Empty;

            compareGraph = new UndirectedDenseGraph <ComparableTuple>(numClusters * vertexPerCluster);
            result       = result + MakeGraph(compareGraph, result);

            testGraph = new CliqueGraph <ComparableTuple>(compareGraph);
            // ICollection<ComparableTuple> component = testGraph.GetConnectedComponent(new ComparableTuple(0, 0));
            // DataStructures.Lists.DLinkedList<ComparableTuple> neighbor = testGraph.Neighbours(new ComparableTuple(0, 0));

            testGraph.RemoveEdge(new ComparableTuple(0, 0), new ComparableTuple(1, 0));

            IGraph <CliqueGraph <ComparableTuple> .Clique> dualGraph = testGraph.buildDualGraph();

            foreach (var x in dualGraph.Vertices)
            {
                foreach (var y in dualGraph.Neighbours(x))
                {
                    result = result + string.Format("{0}---{1}", x, y) + "\n";
                }
            }

            // CliqueGraph.Edges test
            foreach (var edge in testGraph.Edges)
            {
                //System.Diagnostics.Debug.WriteLine(string.Format("{0} -> {1}\t", edge.Source, edge.Destination));
            }

            result = result + "\n";

            foreach (var edge in testGraph.OutgoingEdges(new ComparableTuple(0, 0)))
            {
                result = result + string.Format("{0} -> {1}\t", edge.Source, edge.Destination) + "\n";
            }

            HtmlString html = StringHelper.GetHtmlString(result.Replace("\t", "&emsp;"));

            return(View(html));
        }