PageRank is an algorithm used by search engines to determine the importance of website pages. It calculates the likelihood that a visitor will visit a particular page by randomly clicking on other webpages. The algorithm considers a page more important if it receives more links from other websites. The PageRank of a page is calculated using a formula that takes into account the PageRank of the pages that link to it and the number of outbound links on those pages. The formula also includes a damping factor, which affects the calculation. A higher PageRank indicates a greater probability of the site being reached.
------

SET SCHEMA DM_PAL;
DROP TABLE PAL_PAGERANK_DATA_TBL;
CREATE COLUMN TABLE PAL_PAGERANK_DATA_TBL(
	"FROM_NODE" VARCHAR (100), 
	"TO_NODE" VARCHAR (100)
);
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node1', 'Node2');
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node1', 'Node3');
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node1', 'Node4');
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node2', 'Node3');
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node2', 'Node4');
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node3', 'Node1');
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node4', 'Node1');
INSERT INTO PAL_PAGERANK_DATA_TBL VALUES ('Node4', 'Node3');

DROP TABLE #PAL_PARAMETER_TBL;
CREATE LOCAL TEMPORARY COLUMN TABLE #PAL_PARAMETER_TBL(
	"PARAM_NAME" NVARCHAR(256), 
	"INT_VALUE" INTEGER, 
	"DOUBLE_VALUE" DOUBLE, 
	"STRING_VALUE" NVARCHAR(1000)
);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('DAMPING', NULL, 0.85, NULL); 
CALL _SYS_AFL.PAL_PAGERANK(PAL_PAGERANK_DATA_TBL, "#PAL_PARAMETER_TBL", ?);
