static void Main(string[] args) { GraphGenerator graphGenerator = new GraphGenerator(); IGraph graph = graphGenerator.Generator(); String[] metadataCollection = graph.GetRequiredValue(ReservedMetadataKeys.AllVertexMetadataKeys, typeof(String[])) as String[]; List <string> vertexExampleValues = new List <string>(); foreach (var metadata in metadataCollection) { IVertex vertex = graph.Vertices.FirstOrDefault(); if (vertex.GetValue(metadata) != null) { vertexExampleValues.Add(vertex.GetValue(metadata).ToString()); } } var ShowTheExamples = vertexExampleValues; //IVertex discoveredVertex = BreadthFirstSearch(graph, "Last Name", "Pecoraro"); //if (discoveredVertex != null) //{ // string firstName = discoveredVertex.GetValue("First Name").ToString(); // string lastName = discoveredVertex.GetValue("Last Name").ToString(); //} // Testing BFS implementation that iterates through all nodes int numNodesVisited = BreadthFirstSearch(graph); Console.WriteLine("Visited: " + numNodesVisited + " nodes."); OneDimensionalPartitioning(graph); }
static void Main(string[] args) { StreamWriter writer = new StreamWriter("results.txt"); GraphGenerator graphGenerator = new GraphGenerator(); IGraph graph = graphGenerator.Generator(false); IVertex root = graph.Vertices.OrderByDescending(a => a.Degree).FirstOrDefault(); //IVertex discoveredVertex = BreadthFirstSearch(graph, "Last Name", "Pecoraro"); //if (discoveredVertex != null) //{ // string firstName = discoveredVertex.GetValue("First Name").ToString(); // string lastName = discoveredVertex.GetValue("Last Name").ToString(); //} // Testing BFS implementation that iterates through all nodes DateTime startTime = DateTime.Now; int numNodesVisited = BreadthFirstSearch(graph, root); DateTime endTime = DateTime.Now; var timediff = endTime - startTime; Console.WriteLine("Visited: " + numNodesVisited + " nodes."); Console.WriteLine("Time to finish execution: " + timediff); writer.WriteLine(timediff.Milliseconds + " sequential"); var firstGraph = graph.Vertices.Where(a => a.Visited == false).ToList(); Console.WriteLine("Unvisited " + firstGraph.Count()); resetGraph(graph); startTime = DateTime.Now; numNodesVisited = ParallelBFS(graph, root); endTime = DateTime.Now; timediff = endTime - startTime; Console.WriteLine("Visited: " + numNodesVisited + " nodes."); Console.WriteLine("Time to finish execution: " + timediff); writer.WriteLine(timediff.Milliseconds + " MTBFS"); var secondGraph = graph.Vertices.Where(a => a.Visited == false); Console.WriteLine("Unvisited " + secondGraph.Count()); resetGraph(graph); startTime = DateTime.Now; numNodesVisited = BFSLevels(graph, root); endTime = DateTime.Now; timediff = endTime - startTime; Console.WriteLine("Visited: " + numNodesVisited + " nodes."); Console.WriteLine("Time to finish execution: " + timediff); var thirdGraph = graph.Vertices.Where(a => a.Visited == false); Console.WriteLine("Unvisited " + thirdGraph.Count()); writer.WriteLine(timediff.Milliseconds + " LSBFS"); resetGraph(graph); startTime = DateTime.Now; numNodesVisited = OneDimensionalPartitioning(graph, root); endTime = DateTime.Now; timediff = endTime - startTime; Console.WriteLine("Visited: " + numNodesVisited + " nodes."); Console.WriteLine("Time to finish execution: " + timediff); var fourthGraph = graph.Vertices.Where(a => a.Visited == false); Console.WriteLine("Unvisited " + fourthGraph.Count()); writer.WriteLine(timediff.Milliseconds + " PPBFS"); writer.Close(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); }