示例#1
0
        static void Main(string[] args)
        {
            DateTime dt     = DateTime.Now;
            int      option = 0;

            if (args.Length != 2)
            {
                throw new ArgumentException(
                          "Wrong number of arguments!Please specify two paths for the first and second input graphs");
            }

            var   G1 = GraphLoader.LoadGraph(args[0]);
            var   G2 = GraphLoader.LoadGraph(args[1]);
            State s  = new State(G1.AdjacencyMatrix, G2.AdjacencyMatrix);

            if (option == 0)
            {
                Console.Write("V Solution\n");
                SolutionV.McGregor(new State(G1.AdjacencyMatrix, G2.AdjacencyMatrix), ref s);
            }
            else
            {
                Console.Write("V+E Solution\n");
                SolutionV.McGregor(new State(G1.AdjacencyMatrix, G2.AdjacencyMatrix), ref s, 1);
            }

            //List<Edge> edges = s.correspondingEdges.Select(x => x.Item1).ToList();
            GraphLoader.WriteSummary(G1, G2, s.correspondingEdges,
                                     s.correspondingVerticles.Count(x => x.v1 != -1 && x.v2 != -1));
        }
示例#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);
        }