9.48 OPG_APIS.PR
Format
OPG_APIS.PR( edge_tab_name IN VARCHAR2, d IN NUMBER DEFAULT 0.85, num_iterations IN NUMBER DEFAULT 10, convergence IN NUMBER DEFAULT 0.1, dop IN INTEGER DEFAULT 4, wt_node_pr IN OUT VARCHAR2, wt_node_nextpr IN OUT VARCHAR2, wt_edge_tab_deg IN OUT VARCHAR2, wt_delta IN OUT VARCHAR2, tablespace IN VARCHAR2 DEFAULT NULL, options IN VARCHAR2 DEFAULT NULL, num_vertices OUT NUMBER);
Description
Prepares for page rank calculations.
Parameters
- edge_tab_name
-
Name of the property graph edge table.
- d
-
Damping factor.
- num_iterations
-
Number of iterations for calculating the page rank values.
- convergence
-
A threshold. If the difference between the page rank value of the current iteration and next iteration is lower than this threshold, then computation stops.
- dop
-
Degree od parallelism for the operation.
- wt_node_pr
-
Name of the working table to hold the page rank values of the vertices.
- wt_node_pr
-
Name of the working table to hold the page rank values of the vertices.
- wt_node_next_pr
-
Name of the working table to hold the page rank values of the vertices in the next iteration.
- wt_edge_tab_deg
-
Name of the working table to hold edges and node degree information.
- wt_delta
-
Name of the working table to hold information about some special vertices.
- tablespace
-
Name of the tablespace to hold all the graph data and index data.
- options
-
Additional settings for the operation. An optional string with one or more (comma-separated) of the following values:
-
CREATE_UNDIRECTED=T
-
REUSE_UNDIRECTED_TAB=T
-
- num_vertices
-
Number of vertices processed by the page rank calculation.
Usage Notes
The property graph edge table must exist in the database, and the OPG_APIS.PR_PREP procedure must have been called.
Examples
The following example performs preparation, and then calculates the page rank value of vertices in a property graph named mypg
.
set serveroutput on DECLARE wt_pr varchar2(2000); -- name of the table to hold PR value of the current iteration wt_npr varchar2(2000); -- name of the table to hold PR value for the next iteration wt3 varchar2(2000); wt4 varchar2(2000); wt5 varchar2(2000); n_vertices number; BEGIN wt_pr := 'mypgPR'; opg_apis.pr_prep('mypgGE$', wt_pr, wt_npr, wt3, wt4, null); dbms_output.put_line('Working table names ' || wt_pr || ', wt_npr ' || wt_npr || ', wt3 ' || wt3 || ', wt4 '|| wt4); opg_apis.pr('mypgGE$', 0.85, 10, 0.01, 4, wt_pr, wt_npr, wt3, wt4, 'SYSAUX', null, n_vertices) ; END; /
The output will be similar to the following.
Working table names "MYPGPR", wt_npr "MYPGGE$$TWPRX277", wt3 "MYPGGE$$TWPRE277", wt4 "MYPGGE$$TWPRD277"
The calculated page rank value is stored in the mypgpr table which has the following definition and data.
SQL> desc mypgpr; Name Null? Type ----------------------------------------- -------- ---------------------------- NODE NOT NULL NUMBER PR NUMBER C NUMBER SQL> select node, pr from mypgpr; NODE PR ---------- ---------- 101 .1925 201 .2775 102 .1925 104 .74383125 105 .313625 103 .1925 100 .15 200 .15
Parent topic: OPG_APIS Package Subprograms