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));
            }
        }
Ejemplo n.º 2
0
Archivo: Q2.cs Proyecto: Tilps/Stash
 static void Main(string[] args)
 {
     CliqueGraph c = new CliqueGraph();
     object o = c.calcSum();
     PrintObj(o);
     System.Console.In.ReadLine();
 }
Ejemplo n.º 3
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));
        }
        public void WhenGraphIsInstantiatedWithNull()
        {
            List <string> nullList = null;

            _cliqueGraph = new CliqueGraph <string>(nullList);
        }
 public void WhenGraphIsInstantiatedWithVertices(string vertices)
 {
     _cliqueGraph = new CliqueGraph <string>(vertices.Split(","));
 }
 public void GivenTheGraphIsEmpty()
 {
     _cliqueGraph = new CliqueGraph <string>();
 }