Question: #include #include #include AdjacencyList.h using namespace std; / / prints the PageRank of all pages after p powerIterations in ascending / / alphabetical order
#include
#include
#include "AdjacencyList.h
using namespace std;
prints the PageRank of all pages after p powerIterations in ascending
alphabetical order of webpages and rounding rank to two decimal places
void AdjacencyList::PageRankint n
optionally, store your output in a stringstringstream and then return it from this function after printing so that it is easier to test with Catch
for auto& page: InDegree
Rankingpagefirstf floatInDegree.size;
Creates a new map to hold old page ranks
mapNewRanking;
find the page rank for the iterations
forint i ; isecond Rankingconnection;
NewRankingpagefirst result;
Ranking NewRanking;
map::iterator RankIterator;
forRankIterator Ranking.begin; RankIterator Ranking.end; RankIterator
cout setprecision fixed RankIteratorfirst RankIteratorsecond;
cout
;
void AdjacencyList::Edgesstring from, string to
OutDegreefrom;
InDegreetopushbackfrom;
ifOutDegree.findto OutDegree.end
OutDegreeto;
ifInDegree.findfrom InDegree.end
InDegreefrom;
;
#pragma once
#include
#include
#include
#include
using namespace std;
class AdjacencyList
private:
To store sites based on rank
map Ranking;
To store Out Degree
map OutDegree;
To store In Degree
map InDegree;
public:
Think about what helper functions you will need in the algorithm
void PageRankint n;
void Edgesstring from, string to;
;
Main.c
#include
#include "AdjacencyList.h
using namespace std;
int main
AdjacencyList CreatedGraph;
int nooflines, poweriterations;
string from, to;
cin nooflines;
cin poweriterations;
for int i ; i nooflines; i
cin from;
cin to;
CreatedGraph.Edgesfrom to;
Create a graph object
CreatedGraph.PageRankpoweriterations;
Describe the data structure you used to implement the graph and why.
What is the computational complexity of each method in your implementation in the worst case in terms of Big O notation?
What is the computational complexity of your main method in your implementation in the worst case in terms of Big O notation?
What did you learn from this assignment, and what would you do differently if you had to start over?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
