**PageRank & HITS Calculator**
For your data science needs
The program can be found [here](calc).
About
==============
I, Antonio Noack, am a computer science student from Jena, Germany. I intend to study Computational and Data Science after I finished my bachelor thesis in the area of the Semantic Web.
When looking for a good online tool to calculate [PageRank](https://en.wikipedia.org/wiki/PageRank) and [HITS](https://en.wikipedia.org/wiki/HITS_algorithm) scores for my thesis example, I found a nice program, however without settings, for PageRank, and none for HITS.
Since both are relatively easy to calculate, I wrote my own website for that.
The program is [OpenSource](https://github.com/AntonioNoack/WebPageRank), and can be modified for your needs, thanks to the Apache 2.0 License :).
Data Import
==============
You can create graphs in two ways: either drag nodes, and connect them, and such, or you can upload a [JSON](https://en.wikipedia.org/wiki/JSON) file containing the data. Do give you examples, you can export to JSON as well.
Format
--------------
The JSON data is a JSON object containing two fields, similar to the graph definition of G = (V, E).
Vertices(V)
--------------
The first field, an array, describes the vertices. It's called "vertices".
Each node/vertex can have a name ("name"), and stored values for PageRank (property "pr"), and HITS (properties "hub" + "auth" for hub and auth-scores).
Additionally, the properties x, y, backgroundColor, and textColor are used for the visuals.
Edges (E)
--------------
The second field is the edges, called "edges".
They are encoded as a list of triples (an array each).
Each triple has the following structure:
`````````json
[
"index of from-vertex",
"index of to-vertex",
"weight"
]
`````````
e.g.
`````````json
[
0,
1,
0.5
]
`````````
for an edge from the first node to the second, with a weight of 0.5.
If the weight property is missing, it's assumed to be 1.
Example
----------------
`````````json
{
"vertices": [
{
"name": "Node 0, first",
"x": 0, "y": 0,
"pr": 0.5,
"hub": 1,
"auth": 2
},
{
"name": "Node 1, second",
"x": 3, "y": 0,
}
],
"edges": [
[0,1,1]
]
}
`````````
Additionally, the data can be passed as a link argument ("data").
The program, with the example passed as argument, is [here](https://phychi.com/pagerank/calc?data=eyJlIjpbWzAsMSwxXV0sInYiOltbIk5vZGUgMCwgZmlyc3QiLDAsMF0sWyJOb2RlIDEsIHNlY29uZCIsMywwXV19).
In this case, a compressed JSON representation is used, which then is encoded to [Base 64](https://en.wikipedia.org/wiki/Base64). In this representation, the "vertices" attribute is called "v", the "edge" attribute is called "e", and all vertices are encoded as an array, with the contents Name, X-Coordinate, Y-Coordinate instead of an object. This makes URLs shorter. The usual way to get a short URL for your needs is to use the field "Share your graph" in the program controls on the left.
This is the compressed version as JSON:
`````````json
{
"e":[
[0, 1, 1]
],
"v":[
["Node 0, first", 0, 0],
["Node 1, second", 3, 0]
]
}
`````````
where then all spacings are removed, and the Base 64 encoding is applied. This result in the following string:
`````````base64
eyJlIjpbWzAsMSwxXV0sInYiOltbIk5vZGUgMCwgZmlyc3QiLDAsMF0sWyJOb2RlIDEsIHNlY29uZCIsMywwXV19
`````````
The resulting link is [https://phychi.com/pagerank/calc?data=eyJlIjpbWzAsMSwxXV0sInYiOltbIk5vZGUgMCwgZmlyc3QiLDAsMF0sWyJOb2RlIDEsIHNlY29uZCIsMywwXV19](https://phychi.com/pagerank/calc?data=eyJlIjpbWzAsMSwxXV0sInYiOltbIk5vZGUgMCwgZmlyc3QiLDAsMF0sWyJOb2RlIDEsIHNlY29uZCIsMywwXV19).
----------
[©2020 Antonio Noack](https:phychi.com/impressum)