static void Main(string[] args)
        {
            bool[,] gA, gB;
            if (args.Any())
            {
                if (!GraphReader.tryReadArgs(args, out gA, out gB))
                {
                    return;
                }
            }
            else
            {
                gA = new[, ]
                {
                    { false, true, false, false, true },
                    { true, false, true, false, false },
                    { false, true, false, true, false },
                    { false, false, true, false, true },
                    { true, false, false, true, false }
                };
                gB = new[, ]
                {
                    { false, true, false, false, true },
                    { true, false, true, false, false },
                    { false, true, false, true, false },
                    { false, false, true, false, true },
                    { true, false, false, true, false }
                };
            }

            Graph graphA = new Graph(gA), graphB = new Graph(gB);

            Console.WriteLine("Graph A edges: " + graphA);
            Console.WriteLine("Graph B edges: " + graphB);
            Console.WriteLine();

            var modularGraph     = new ModularGraph(graphA, graphB);
            var vertexModeResult = modularGraph.LargestCliqueHeuristic(true);

            Console.WriteLine("Vertices count maximum subgraph:");
            Console.WriteLine(vertexModeResult.ConvertToString());
            Console.WriteLine();
            var sumModeResult = modularGraph.LargestCliqueHeuristic(false);

            Console.WriteLine("Vertices and edges sum maximum subgraph:");
            Console.WriteLine(sumModeResult.ConvertToString());
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length != 3 || (args[2] != "V" && args[2] != "E"))
            {
                throw new ArgumentException("Invalid arguments!");
            }

            var graphA = GraphLoader.LoadGraph(args[0]);
            var graphB = GraphLoader.LoadGraph(args[1]);

            Console.WriteLine();

            var modularGraph = new ModularGraph(graphA, graphB);
            var result       = modularGraph.LargestCliqueHeuristic(args[2] == "1");
            var edgesA       = graphA.Subgraph(result.Item1).Edges;
            var edgesB       = graphB.Subgraph(result.Item2).Edges;

            GraphLoader.WriteSummary(graphA, graphB, edgesA, edgesB, result.Item1.Count);
        }