HITS
This feature is in the alpha tier. For more information on feature tiers, see API Tiers.
1. Introduction
The Hyperlink-Induced Topic Search (HITS) is a link analysis algorithm that rates nodes based on two scores, a hub
score and an authority
score.
The authority
score estimates the importance of the node within the network.
The hub
score estimates the value of its relationships to other nodes.
The GDS implementation is based on the Authoritative Sources in a Hyperlinked Environment publication by Jon M. Kleinberg.
The HITS algorithm requires the inverse index for each relationship type. |
2. Syntax
This section covers the syntax used to execute the HITS algorithm in each of its execution modes. We are describing the named graph variant of the syntax. To learn more about general syntax variants, see Syntax overview.
CALL gds.alpha.hits.stream(
graphName: String,
configuration: Map
)
YIELD
nodeId: Integer,
values: Map
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description |
---|---|---|---|---|
List of String |
|
yes |
Filter the named graph using the given node labels. |
|
List of String |
|
yes |
Filter the named graph using the given relationship types. |
|
Integer |
|
yes |
The number of concurrent threads used for running the algorithm. |
|
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
|
Boolean |
|
yes |
If disabled the progress percentage will not be logged. |
|
hitsIterations |
Integer |
|
no |
The number of hits iterations to run. The number of pregel iterations will be equal to |
authProperty |
String |
|
yes |
The name that is used for the auth property when using |
hubProperty |
String |
|
yes |
The name that is used for the hub property when using |
Name | Type | Description |
---|---|---|
nodeId |
Integer |
Node ID. |
values |
Map |
A map containing the |
CALL gds.alpha.hits.stats(
graphName: String,
configuration: Map
)
YIELD
ranIterations: Integer,
didConverge: Boolean,
preProcessingMillis: Integer,
computeMillis: Integer,
configuration: Map
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description |
---|---|---|---|---|
List of String |
|
yes |
Filter the named graph using the given node labels. |
|
List of String |
|
yes |
Filter the named graph using the given relationship types. |
|
Integer |
|
yes |
The number of concurrent threads used for running the algorithm. |
|
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
|
Boolean |
|
yes |
If disabled the progress percentage will not be logged. |
|
hitsIterations |
Integer |
|
no |
The number of hits iterations to run. The number of pregel iterations will be equal to |
authProperty |
String |
|
yes |
The name that is used for the auth property when using |
hubProperty |
String |
|
yes |
The name that is used for the hub property when using |
Name | Type | Description |
---|---|---|
ranIterations |
Integer |
Number of iterations run. |
didConverge |
Boolean |
Indicates if the algorithm converged. |
preProcessingMillis |
Integer |
Milliseconds for preprocessing the graph. |
computeMillis |
Integer |
Milliseconds for running the algorithm. |
configuration |
Map |
Configuration used for running the algorithm. |
CALL gds.alpha.hits.mutate(
graphName: String,
configuration: Map
)
YIELD
ranIterations: Integer,
didConverge: Boolean,
preProcessingMillis: Integer,
computeMillis: Integer,
mutateMillis: Integer,
nodePropertiesWritten: Integer,
configuration: Map
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description |
---|---|---|---|---|
List of String |
|
yes |
Filter the named graph using the given node labels. |
|
List of String |
|
yes |
Filter the named graph using the given relationship types. |
|
Integer |
|
yes |
The number of concurrent threads used for running the algorithm. |
|
mutateProperty |
String |
|
yes |
The prefix used for all public properties in the PregelSchema. |
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
|
hitsIterations |
Integer |
|
no |
The number of hits iterations to run. The number of pregel iterations will be equal to |
authProperty |
String |
|
yes |
The name that is used for the auth property when using |
hubProperty |
String |
|
yes |
The name that is used for the hub property when using |
Name | Type | Description |
---|---|---|
ranIterations |
Integer |
The number of iterations run. |
didConverge |
Boolean |
Indicates if the algorithm converged. |
preProcessingMillis |
Integer |
Milliseconds for preprocessing the graph. |
computeMillis |
Integer |
Milliseconds for running the algorithm. |
mutateMillis |
Integer |
Milliseconds for adding properties to the projected graph. |
nodePropertiesWritten |
Integer |
The number of properties that were written to Neo4j. |
configuration |
Map |
The configuration used for running the algorithm. |
CALL gds.alpha.hits.write(
graphName: String,
configuration: Map
)
YIELD
ranIterations: Integer,
didConverge: Boolean,
preProcessingMillis: Integer,
computeMillis: Integer,
writeMillis: Integer,
nodePropertiesWritten: Integer,
configuration: Map
Name | Type | Default | Optional | Description |
---|---|---|---|---|
graphName |
String |
|
no |
The name of a graph stored in the catalog. |
configuration |
Map |
|
yes |
Configuration for algorithm-specifics and/or graph filtering. |
Name | Type | Default | Optional | Description |
---|---|---|---|---|
List of String |
|
yes |
Filter the named graph using the given node labels. |
|
List of String |
|
yes |
Filter the named graph using the given relationship types. |
|
Integer |
|
yes |
The number of concurrent threads used for running the algorithm. |
|
String |
|
yes |
An ID that can be provided to more easily track the algorithm’s progress. |
|
Boolean |
|
yes |
If disabled the progress percentage will not be logged. |
|
Integer |
|
yes |
The number of concurrent threads used for writing the result to Neo4j. |
|
writeProperty |
String |
|
yes |
The prefix used for all public properties in the PregelSchema. |
hitsIterations |
Integer |
|
no |
The number of hits iterations to run. The number of pregel iterations will be equal to |
authProperty |
String |
|
yes |
The name that is used for the auth property when using |
hubProperty |
String |
|
yes |
The name that is used for the hub property when using |
Name | Type | Description |
---|---|---|
ranIterations |
Integer |
The number of iterations run. |
didConverge |
Boolean |
Indicates if the algorithm converged. |
preProcessingMillis |
Integer |
Milliseconds for preprocessing the graph. |
computeMillis |
Integer |
Milliseconds for running the algorithm. |
writeMillis |
Integer |
Milliseconds for writing result data back. |
nodePropertiesWritten |
Integer |
The number of properties that were written to Neo4j. |
configuration |
Map |
The configuration used for running the algorithm. |
3. Examples
In this section we will show examples of running the HITS algorithm on a concrete graph. The intention is to illustrate what the results look like and to provide a guide in how to make use of the algorithm in a real setting. We will do this on a small social network graph of a handful nodes connected in a particular pattern. The example graph looks like this:
CREATE
(a:Website {name: 'A'}),
(b:Website {name: 'B'}),
(c:Website {name: 'C'}),
(d:Website {name: 'D'}),
(e:Website {name: 'E'}),
(f:Website {name: 'F'}),
(g:Website {name: 'G'}),
(h:Website {name: 'H'}),
(i:Website {name: 'I'}),
(a)-[:LINK]->(b),
(a)-[:LINK]->(c),
(a)-[:LINK]->(d),
(b)-[:LINK]->(c),
(b)-[:LINK]->(d),
(c)-[:LINK]->(d),
(e)-[:LINK]->(b),
(e)-[:LINK]->(d),
(e)-[:LINK]->(f),
(e)-[:LINK]->(h),
(f)-[:LINK]->(g),
(f)-[:LINK]->(i),
(f)-[:LINK]->(h),
(g)-[:LINK]->(h),
(g)-[:LINK]->(i),
(h)-[:LINK]->(i);
In the example, we will use the HITS algorithm to calculate the authority and hub scores.
CALL gds.graph.project(
'myGraph',
'Website',
{LINK: {indexInverse: true}}
);
In the following examples we will demonstrate using the HITS algorithm on this graph.
3.1. Stream
In the stream
execution mode, the algorithm returns the authority and hub scores for each node.
This allows us to inspect the results directly or post-process them in Cypher without any side effects.
For more details on the stream
mode in general, see Stream.
CALL gds.alpha.hits.stream('myGraph', {hitsIterations: 20})
YIELD nodeId, values
RETURN gds.util.asNode(nodeId).name AS Name, values.auth AS auth, values.hub as hub
ORDER BY Name ASC
Name | auth | hub |
---|---|---|
"A" |
0.0 |
0.5147630377521207 |
"B" |
0.42644630743935796 |
0.3573686670593437 |
"C" |
0.3218729455718005 |
0.23857061715828276 |
"D" |
0.6463862608483191 |
0.0 |
"E" |
0.0 |
0.640681017095129 |
"F" |
0.23646490227616518 |
0.2763222153580397 |
"G" |
0.10200264424057169 |
0.23867470447760597 |
"H" |
0.426571816146601 |
0.0812340105698113 |
"I" |
0.22009646020698218 |
0.0 |
Was this page helpful?