cs-page-rank
1.0.1
dotnet add package cs-page-rank --version 1.0.1
NuGet\Install-Package cs-page-rank -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="cs-page-rank" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add cs-page-rank --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: cs-page-rank, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install cs-page-rank as a Cake Addin #addin nuget:?package=cs-page-rank&version=1.0.1 // Install cs-page-rank as a Cake Tool #tool nuget:?package=cs-page-rank&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
cs-page-rank
Iterative PageRank implemented in .NET 4.6.1
Install
Install-Package cs-page-rank
Usage
The sample code below shows how to use the page rank to perform link analysis:
using System;
using System.Collections.Generic;
namespace PageRank
{
class Program
{
static void Main(string[] args)
{
PageRankByIterativeMethod();
PageRankByMatrixIterativeMethod();
}
private static void PageRankByIterativeMethod()
{
Random random = new Random();
int pageCount = 1000;
IterativePageRank pr = new IterativePageRank(pageCount);
List<int> pages = new List<int>();
for(int pageId = 0; pageId < pageCount; ++pageId)
{
pages.Add(pageId);
}
for(int fromPageId =0; fromPageId < pageCount; ++fromPageId)
{
int outLinkCount = random.Next(pageCount / 50);
Shuffle(pages, random);
for(int i=0; i < outLinkCount; ++i)
{
int toPageId = pages[i];
pr.AddLink(fromPageId, toPageId);
}
}
double tolerance = 0.00001;
float[] ranks = pr.RankPages(tolerance);
for(int pageId = 0; pageId < 50; ++pageId)
{
Console.WriteLine("Page: {0}, Score: {1}", pageId, ranks[pageId]);
}
}
private static void PageRankByMatrixIterativeMethod()
{
Random random = new Random();
int pageCount = 1000;
MatrixIterativePageRank pr = new MatrixIterativePageRank(pageCount);
List<int> pages = new List<int>();
for (int pageId = 0; pageId < pageCount; ++pageId)
{
pages.Add(pageId);
}
for (int fromPageId = 0; fromPageId < pageCount; ++fromPageId)
{
int outLinkCount = random.Next(pageCount / 50);
Shuffle(pages, random);
for (int i = 0; i < outLinkCount; ++i)
{
int toPageId = pages[i];
pr.AddLink(fromPageId, toPageId);
}
}
double tolerance = 0.00001;
double[] ranks = pr.RankPages(tolerance);
for (int pageId = 0; pageId < 50; ++pageId)
{
Console.WriteLine("Page: {0}, Score: {1}", pageId, ranks[pageId]);
}
}
private static void Shuffle<T>(List<T> a, Random random)
{
int i = 0;
while(i < a.Count)
{
int j = random.Next(i + 1);
Swap(a, i, j);
i++;
}
}
private static void Swap<T>(List<T> a, int i, int j)
{
T temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 1,139 | 5/1/2018 |
Page Rank in .NET 4.6.1