Class Analyst

java.lang.Object
oracle.pgx.api.internal.ApiObject
oracle.pgx.api.Destroyable
oracle.pgx.api.Analyst
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
NamedArgumentAnalyst

public class Analyst extends Destroyable
The Analyst gives access to all built-in algorithms of PGX. Unlike other classes inside this package, the Analyst is not stateless. It creates session-bound transient data to hold the result of algorithms and keeps track of them. Once Destroyable.destroy() is invoked, all transient data returned by the Analyst gets freed and cannot be used anymore.
  • Method Details

    • getSession

      public PgxSession getSession()
      Gets the session.
      Returns:
      the PGX session
    • loadPg2vecModel

      public Pg2vecModel loadPg2vecModel(String path, String key) throws InterruptedException, ExecutionException
      Loads an encrypted pg2vec model
      Parameters:
      path - the path
      key - the decryption key, or null if no encryption was used
      Returns:
      the loaded model
      Throws:
      InterruptedException
      ExecutionException
    • loadPg2vecModel

      public GenericModelLoader<Pg2vecModel> loadPg2vecModel()
      Returns GenericModelLoader to configure how to load a Pg2vec model and then trigger it.
      Returns:
      a GenericModelLoader to configure how to load a Pg2vec model
      Since:
      21.1
    • pg2vecModelBuilder

      public Pg2vecModelBuilder pg2vecModelBuilder()
      Builds a pg2vec model
      Returns:
    • loadDeepWalkModel

      public DeepWalkModel loadDeepWalkModel(String path, String key) throws InterruptedException, ExecutionException
      Loads an encrypted Deepwalk model
      Parameters:
      path - the path
      key - the decryption key, or null if no encryption was used
      Returns:
      the loaded model
      Throws:
      InterruptedException
      ExecutionException
    • loadDeepWalkModel

      public GenericModelLoader<DeepWalkModel> loadDeepWalkModel()
      Returns GenericModelLoader to configure how to load a DeepWalk model and then trigger it.
      Returns:
      a GenericModelLoader to configure how to load a DeepWalk model
      Since:
      21.1
    • modelRepository

      public GenericModelRepositoryBuilder modelRepository()
      Builder for model repository.
      Returns:
      the builder
      Since:
      22.2
    • deepWalkModelBuilder

      public DeepWalkModelBuilder deepWalkModelBuilder()
      Builder for Deepwalk model
      Returns:
      the builder
    • loadSupervisedGraphWiseModel

      public SupervisedGraphWiseModel loadSupervisedGraphWiseModel(String path, String key) throws InterruptedException, ExecutionException
      Loads an encrypted SupervisedGraphWise model
      Parameters:
      path - the path
      key - the decryption key, or null if no encryption was used
      Returns:
      the loaded model
      Throws:
      InterruptedException
      ExecutionException
    • loadSupervisedGraphWiseModel

      public GenericModelLoader<SupervisedGraphWiseModel> loadSupervisedGraphWiseModel()
      Returns GenericModelLoader to configure how to load a SupervisedGraphWiseModel model and then trigger it.
      Returns:
      a GenericModelLoader to configure how to load a SupervisedGraphWiseModel model
      Since:
      21.1
    • supervisedGraphWiseModelBuilder

      public SupervisedGraphWiseModelBuilder supervisedGraphWiseModelBuilder()
      Return a SupervisedGraphWise model builder that can be used to set the configuration of the model and then create it.
      Returns:
      the builder
    • graphWiseConvLayerConfigBuilder

      public GraphWiseConvLayerConfigBuilder graphWiseConvLayerConfigBuilder()
      Return a GraphWiseConvLayerConfigBuilder used to create a GraphWiseConvLayerConfig
      Returns:
      the builder
    • graphWiseAttentionLayerConfigBuilder

      public GraphWiseAttentionLayerConfigBuilder graphWiseAttentionLayerConfigBuilder()
      Return a GraphWiseAttentionLayerConfigBuilder used to create a GraphWiseAttentionLayerConfig
      Returns:
      the builder
    • graphWiseValidationConfigBuilder

      public GraphWiseValidationConfigBuilder graphWiseValidationConfigBuilder()
      Return a GraphWiseValidationConfigBuilder used to create a GraphWiseValidationConfig
      Returns:
      the builder
    • graphWiseDgiLayerConfigBuilder

      public GraphWiseDgiLayerConfigBuilder graphWiseDgiLayerConfigBuilder()
      Return a GraphWiseDgiLayerConfigBuilder used to create a GraphWiseDgiLayerConfig
      Returns:
      the builder
    • graphWiseDominantLayerConfigBuilder

      public GraphWiseDominantLayerConfigBuilder graphWiseDominantLayerConfigBuilder()
      Return a GraphWiseDominantLayerConfigBuilder used to create a GraphWiseDominantLayerConfig
      Returns:
      the builder
    • graphWisePredictionLayerConfigBuilder

      public GraphWisePredictionLayerConfigBuilder graphWisePredictionLayerConfigBuilder()
      Return a GraphWisePredictionLayerConfigBuilder used to create a GraphWiseLayerConfig
      Returns:
      the builder
    • categoricalPropertyConfigBuilder

      public CategoricalPropertyConfigBuilder categoricalPropertyConfigBuilder(String featureName)
      Return a CategoricalPropertyConfigBuilder used to create a CategoricalPropertyConfig
      Returns:
      the builder
    • continuousPropertyConfigBuilder

      public ContinuousPropertyConfigBuilder continuousPropertyConfigBuilder(String featureName)
      Return a ContinuousPropertyConfigBuilder used to create a ContinuousPropertyConfig
      Returns:
      the builder
    • loadSupervisedEdgeWiseModel

      public SupervisedEdgeWiseModel loadSupervisedEdgeWiseModel(String path, String key) throws InterruptedException, ExecutionException
      Loads an encrypted SupervisedEdgeWise model
      Parameters:
      path - the path
      key - the decryption key, or null if no encryption was used
      Returns:
      the loaded model
      Throws:
      InterruptedException
      ExecutionException
    • loadUnsupervisedEdgeWiseModel

      public UnsupervisedEdgeWiseModel loadUnsupervisedEdgeWiseModel(String path, String key) throws InterruptedException, ExecutionException
      Loads an encrypted UnsupervisedEdgeWise model
      Parameters:
      path - the path
      key - the decryption key, or null if no encryption was used
      Returns:
      the loaded model
      Throws:
      InterruptedException
      ExecutionException
    • loadSupervisedEdgeWiseModel

      public GenericModelLoader<SupervisedEdgeWiseModel> loadSupervisedEdgeWiseModel()
      Returns GenericModelLoader to configure how to load a SupervisedEdgeWiseModel model and then trigger it.
      Returns:
      a GenericModelLoader to configure how to load a SupervisedEdgeWiseModel model
      Since:
      23.1
    • loadUnsupervisedEdgeWiseModel

      public GenericModelLoader<UnsupervisedEdgeWiseModel> loadUnsupervisedEdgeWiseModel()
      Returns GenericModelLoader to configure how to load a UnsupervisedEdgeWiseModel model and then trigger it.
      Returns:
      a GenericModelLoader to configure how to load a UnsupervisedEdgeWiseModel model
      Since:
      23.2
    • supervisedEdgeWiseModelBuilder

      public SupervisedEdgeWiseModelBuilder supervisedEdgeWiseModelBuilder()
      Return a SupervisedEdgeWise model builder that can be used to set the configuration of the model and then create it.
      Returns:
      the builder
    • unsupervisedEdgeWiseModelBuilder

      public UnsupervisedEdgeWiseModelBuilder unsupervisedEdgeWiseModelBuilder()
      Return a UnsupervisedEdgeWise model builder that can be used to set the configuration of the model and then create it.
      Returns:
      the builder
    • loadUnsupervisedGraphWiseModel

      public UnsupervisedGraphWiseModel loadUnsupervisedGraphWiseModel(String path, String key) throws InterruptedException, ExecutionException
      Loads an encrypted UnsupervisedGraphWise model
      Parameters:
      path - the path
      key - the decryption key, or null if no encryption was used
      Returns:
      the loaded model
      Throws:
      InterruptedException
      ExecutionException
    • loadUnsupervisedGraphWiseModel

      public GenericModelLoader<UnsupervisedGraphWiseModel> loadUnsupervisedGraphWiseModel()
      Returns GenericModelLoader to configure how to load a UnsupervisedGraphWise model and then trigger it.
      Returns:
      a GenericModelLoader to configure how to load a UnsupervisedGraphWise model
      Since:
      21.2
    • loadUnsupervisedAnomalyDetectionGraphWiseModel

      public GenericModelLoader<UnsupervisedAnomalyDetectionGraphWiseModel> loadUnsupervisedAnomalyDetectionGraphWiseModel()
      Returns GenericModelLoader to configure how to load a UnsupervisedAnomalyDetectionGraphWise model and then trigger it.
      Returns:
      a GenericModelLoader to configure how to load a UnsupervisedAnomalyDetectionGraphWise model
      Since:
      23.2
    • unsupervisedGraphWiseModelBuilder

      public UnsupervisedGraphWiseModelBuilder unsupervisedGraphWiseModelBuilder()
      Return a UnsupervisedGraphWise model builder that can be used to set the configuration of the model and then create it.
      Returns:
      the builder
    • unsupervisedAnomalyDetectionGraphWiseModelBuilder

      public UnsupervisedAnomalyDetectionGraphWiseModelBuilder unsupervisedAnomalyDetectionGraphWiseModelBuilder()
      Return a UnsupervisedAnomalyDetectionGraphWiseModel model builder that can be used to set the configuration of the model and then create it.
      Returns:
      the builder
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph, boolean norm)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph, false);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph, double e, double d, int max)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph, 0.001, 0.85, 100);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph, double e, double d, int max, boolean norm)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph, 0.001, 0.85, 100, false);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph, VertexProperty<ID,Double> rank)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph, boolean norm, VertexProperty<ID,Double> rank)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph, false, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph, double e, double d, int max, VertexProperty<ID,Double> rank)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph, 0.001, 0.85, 100, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankAsync(PgxGraph graph, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank)

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankAsync(graph, 0.001, 0.85, 100, false, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankApproximateAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankApproximateAsync(PgxGraph graph)

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankApproximateAsync(graph);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankApproximateAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankApproximateAsync(PgxGraph graph, double e, double d, int max)

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankApproximateAsync(graph, 0.001, 0.85, 100);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankApproximateAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankApproximateAsync(PgxGraph graph, VertexProperty<ID,Double> rank)

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankApproximateAsync(graph, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • pagerankApproximateAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> pagerankApproximateAsync(PgxGraph graph, double e, double d, int max, VertexProperty<ID,Double> rank)

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.pagerankApproximateAsync(
         graph, 0.001, 0.85, 100, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, EdgeProperty<Double> weight)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(graph, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, boolean norm, EdgeProperty<Double> weight)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(graph, false, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, double e, double d, int max, EdgeProperty<Double> weight)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(graph, 0.001, 0.85, 100, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, double e, double d, int max, boolean norm, EdgeProperty<Double> weight)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(
         graph, 0.001, 0.85, 100, false, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(graph, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(graph, false, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, double e, double d, int max, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(
         graph, 0.001, 0.85, 100, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • weightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> weightedPagerankAsync(PgxGraph graph, double e, double d, int max, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.weightedPagerankAsync(
         graph, 0.001, 0.85, 100, false, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(graph, vertex);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, boolean norm)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(graph, vertex, false);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100, false);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, VertexProperty<ID,Double> rank)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(graph, vertex, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, boolean norm, VertexProperty<ID,Double> rank)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(graph, vertex, false, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, VertexProperty<ID,Double> rank)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank)

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100, false, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(graph, vertices);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, boolean norm)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(graph, vertices, false);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100, false);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, VertexProperty<ID,Double> rank)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(graph, vertices, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, boolean norm, VertexProperty<ID,Double> rank)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertices, false, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, VertexProperty<ID,Double> rank)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank)

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100, false, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, EdgeProperty<Double> weight)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, boolean norm, EdgeProperty<Double> weight)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, false, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, EdgeProperty<Double> weight)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm, EdgeProperty<Double> weight)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100, false, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, false, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertex, 0.001, 0.85, 100, false, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, EdgeProperty<Double> weight)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, boolean norm, EdgeProperty<Double> weight)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, false, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, EdgeProperty<Double> weight)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm, EdgeProperty<Double> weight)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100, false, cost);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, false, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • personalizedWeightedPagerankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedWeightedPagerankAsync(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank)

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedWeightedPagerankAsync(
         graph, vertices, 0.001, 0.85, 100, false, cost, rank);
       promise.thenCompose(pagerank -> graph.queryPgqlAsync(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph, boolean norm)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph, false);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph, double e, double d, int max)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph, 0.001, 0.85, 100);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph, double e, double d, int max, boolean norm)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph, 0.001, 0.85, 100, false);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph, VertexProperty<ID,Double> rank)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph, rank);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph, boolean norm, VertexProperty<ID,Double> rank)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph, false, rank);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph, double e, double d, int max, VertexProperty<ID,Double> rank)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph, 0.001, 0.85, 100, rank);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • articleRankAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> articleRankAsync(PgxGraph graph, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank)

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.articleRankAsync(graph, 0.001, 0.85, 100, false,
          rank);
       promise.thenCompose(articlerank -> graph.queryPgqlAsync(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • vertexBetweennessCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> vertexBetweennessCentralityAsync(PgxGraph graph)

      Betweenness centrality measures the centrality of the vertices to identify important vertices for the flow of information

      Definition

      The Betweenness Centrality of a vertex V in a graph is the sum of the fraction of shortest paths that pass through V from all the possible shortest paths connecting every possible pair of vertices S, T in the graph, such that V is different from S and T. Because of its definition, the algorithm is meant for connected graphs.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.vertexBetweennessCentralityAsync(graph);
       promise.thenCompose(betweenness -> graph.queryPgqlAsync(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • vertexBetweennessCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> vertexBetweennessCentralityAsync(PgxGraph graph, VertexProperty<ID,Double> bc)

      Betweenness centrality measures the centrality of the vertices to identify important vertices for the flow of information

      Definition

      The Betweenness Centrality of a vertex V in a graph is the sum of the fraction of shortest paths that pass through V from all the possible shortest paths connecting every possible pair of vertices S, T in the graph, such that V is different from S and T. Because of its definition, the algorithm is meant for connected graphs.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      bc - (out argument) vertex property holding the betweenness centrality value for each vertex.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> bc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.vertexBetweennessCentralityAsync(graph, bc);
       promise.thenCompose(betweenness -> graph.queryPgqlAsync(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • approximateVertexBetweennessCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> approximateVertexBetweennessCentralityAsync(PgxGraph graph, int k)

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using k random vertices as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      k - number of random vertices to be used to compute the approximated betweenness centrality coefficients.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.approximateVertexBetweennessCentralityAsync(
         graph, 100);
       promise.thenCompose(betweenness -> graph.queryPgqlAsync(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • approximateVertexBetweennessCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> approximateVertexBetweennessCentralityAsync(PgxGraph graph, int k, VertexProperty<ID,Double> bc)

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using k random vertices as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      k - number of random vertices to be used to compute the approximated betweenness centrality coefficients.
      bc - (out argument) vertex property holding the betweenness centrality value for each vertex.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> bc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.approximateVertexBetweennessCentralityAsync(
         graph, 100, bc);
       promise.thenCompose(betweenness -> graph.queryPgqlAsync(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • approximateVertexBetweennessCentralityFromSeedsAsync

      @SafeVarargs public final <ID> PgxFuture<VertexProperty<ID,Double>> approximateVertexBetweennessCentralityFromSeedsAsync(PgxGraph graph, PgxVertex<ID>... seeds)

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using the vertices from the given sequence as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      seeds - the (unique) chosen nodes to be used to compute the approximated betweenness centrality coeficients.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> v1 = graph.getVertex(128);
       PgxVertex<Integer> v2 = graph.getVertex(333);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.approximateVertexBetweennessCentralityFromSeedsAsync(
         graph, v1, v2);
       promise.thenCompose(betweenness -> graph.queryPgqlAsync(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • approximateVertexBetweennessCentralityFromSeedsAsync

      @SafeVarargs public final <ID> PgxFuture<VertexProperty<ID,Double>> approximateVertexBetweennessCentralityFromSeedsAsync(PgxGraph graph, VertexProperty<ID,Double> bc, PgxVertex<ID>... seeds)

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using the vertices from the given sequence as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      bc - (out argument) vertex property holding the betweenness centrality value for each vertex.
      seeds - the (unique) chosen nodes to be used to compute the approximated betweenness centrality coeficients.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> bc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxVertex<Integer> v1 = graph.getVertex(128);
       PgxVertex<Integer> v2 = graph.getVertex(333);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.approximateVertexBetweennessCentralityFromSeedsAsync(
         graph, bc, v1, v2);
       promise.thenCompose(betweenness -> graph.queryPgqlAsync(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • closenessCentralityUnitLengthAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> closenessCentralityUnitLengthAsync(PgxGraph graph)

      Closeness centrality measures the centrality of the vertices based on distances, allowing to find well-connected vertices

      Definition

      The Closeness Centrality of a node V is the reciprocal of the sum of all the distances from the possible shortest paths starting from V. Thus the higher the centrality value of V, the closer it is to all the other vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      Returns:
      node property holding the closeness centrality value for each node.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.closenessCentralityUnitLengthAsync(graph);
       promise.thenCompose(closeness -> graph.queryPgqlAsync(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • closenessCentralityUnitLengthAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> closenessCentralityUnitLengthAsync(PgxGraph graph, VertexProperty<ID,Double> cc)

      Closeness centrality measures the centrality of the vertices based on distances, allowing to find well-connected vertices

      Definition

      The Closeness Centrality of a node V is the reciprocal of the sum of all the distances from the possible shortest paths starting from V. Thus the higher the centrality value of V, the closer it is to all the other vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      cc - (out argument) node property holding the closeness centrality value for each node.
      Returns:
      node property holding the closeness centrality value for each node.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> cc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.closenessCentralityUnitLengthAsync(graph, cc);
       promise.thenCompose(closeness -> graph.queryPgqlAsync(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • closenessCentralityDoubleLengthAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> closenessCentralityDoubleLengthAsync(PgxGraph graph, EdgeProperty<Double> cost)

      Closeness centrality measures the centrality of the vertices based on weighted distances, allowing to find well-connected vertices

      Definition

      This variant of Closeness Centrality takes into account the weights from the edges when computing the reciprocal of the sum of all the distances from the possible shortest paths starting from the vertex V, for every vertex in the graph. The weights of the edges must be positive values greater than 0.

      Implementation Details

      The implementation of is more expensive to compute than the normal closeness centrality because of the inclusion of the weights in the edges which influence the selection of edges for the shortest paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E * d) with E = number of edges, V = number of vertices, d = diameter of the graph
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      cost - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the closeness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.closenessCentralityDoubleLengthAsync(graph, cost);
       promise.thenCompose(closeness -> graph.queryPgqlAsync(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • closenessCentralityDoubleLengthAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> closenessCentralityDoubleLengthAsync(PgxGraph graph, EdgeProperty<Double> cost, VertexProperty<ID,Double> cc)

      Closeness centrality measures the centrality of the vertices based on weighted distances, allowing to find well-connected vertices

      Definition

      This variant of Closeness Centrality takes into account the weights from the edges when computing the reciprocal of the sum of all the distances from the possible shortest paths starting from the vertex V, for every vertex in the graph. The weights of the edges must be positive values greater than 0.

      Implementation Details

      The implementation of is more expensive to compute than the normal closeness centrality because of the inclusion of the weights in the edges which influence the selection of edges for the shortest paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E * d) with E = number of edges, V = number of vertices, d = diameter of the graph
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      cost - edge property holding the weight of each edge in the graph.
      cc - (out argument) vertex property holding the closeness centrality value for each vertex.
      Returns:
      vertex property holding the closeness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> cc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.closenessCentralityDoubleLengthAsync(graph, cost, cc);
       promise.thenCompose(closeness -> graph.queryPgqlAsync(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • hitsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Double>,VertexProperty<ID,Double>>> hitsAsync(PgxGraph graph)

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>>> promise = analyst.hitsAsync(
         graph);
       promise.thenCompose(hits -> graph.queryPgqlAsync(
         "SELECT x, x." + hits.getFirst().getName() + " x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • hitsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Double>,VertexProperty<ID,Double>>> hitsAsync(PgxGraph graph, int max)

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      max - number of iterations that will be performed.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>>> promise = analyst.hitsAsync(
         graph, 100);
       promise.thenCompose(hits -> graph.queryPgqlAsync(
         "SELECT x, x." + hits.getFirst().getName() + " x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • hitsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Double>,VertexProperty<ID,Double>>> hitsAsync(PgxGraph graph, int max, VertexProperty<ID,Double> auth, VertexProperty<ID,Double> hubs)

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      max - number of iterations that will be performed.
      auth - (out argument) vertex property holding the authority score for each vertex.
      hubs - (out argument) vertex property holding the hub score for each vertex.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> auth = graph.CreateVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> hubs = graph.CreateVertexProperty(PropertyType.DOUBLE);
       PgxFuture<Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>>> promise = analyst.hitsAsync(
         graph, 100, auth, hubs);
       promise.thenCompose(hits -> graph.queryPgqlAsync(
         "SELECT x, x." + hits.getFirst().getName() + " x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • hitsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Double>,VertexProperty<ID,Double>>> hitsAsync(PgxGraph graph, VertexProperty<ID,Double> auth, VertexProperty<ID,Double> hubs)

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      auth - (out argument) vertex property holding the authority score for each vertex.
      hubs - (out argument) vertex property holding the hub score for each vertex.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> auth = graph.CreateVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> hubs = graph.CreateVertexProperty(PropertyType.DOUBLE);
       PgxFuture<Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>>> promise = analyst.hitsAsync(
         graph, auth, hubs);
       promise.thenCompose(hits -> graph.queryPgqlAsync(
         "SELECT x, x." + hits.getFirst().getName() + " x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • eigenvectorCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> eigenvectorCentralityAsync(PgxGraph graph)

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.eigenvectorCentralityAsync(graph);
       promise.thenCompose(eigenvector -> graph.queryPgqlAsync(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • eigenvectorCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> eigenvectorCentralityAsync(PgxGraph graph, int max, double maxDiff, boolean useL2Norm, boolean useInEdge)

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      max - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      useL2Norm - boolean flag to determine whether the algorithm will use the l2 norm (Euclidean norm) or the l1 norm (absolute value) to normalize the centrality scores.
      useInEdge - boolean flag to determine whether the algorithm will use the incoming or the outgoing edges in the graph for the computations.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.eigenvectorCentralityAsync(
         graph, 100, 0.001, false, false);
       promise.thenCompose(eigenvector -> graph.queryPgqlAsync(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • eigenvectorCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> eigenvectorCentralityAsync(PgxGraph graph, int max, double maxDiff, boolean useL2Norm, boolean useInEdge, VertexProperty<ID,Double> ec)

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      max - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      useL2Norm - boolean flag to determine whether the algorithm will use the l2 norm (Euclidean norm) or the l1 norm (absolute value) to normalize the centrality scores.
      useInEdge - boolean flag to determine whether the algorithm will use the incoming or the outgoing edges in the graph for the computations.
      ec - (out argument) vertex property holding the normalized centrality value for each vertex.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> ec = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.eigenvectorCentralityAsync(
         graph, 100, 0.001, false, false, ec);
       promise.thenCompose(eigenvector -> graph.queryPgqlAsync(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • eigenvectorCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> eigenvectorCentralityAsync(PgxGraph graph, VertexProperty<ID,Double> ec)

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      ec - (out argument) vertex property holding the normalized centrality value for each vertex.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> ec = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.eigenvectorCentralityAsync(graph, ec);
       promise.thenCompose(eigenvector -> graph.queryPgqlAsync(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • outDegreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> outDegreeCentralityAsync(PgxGraph graph)

      Out-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Out-Degree centrality returns the sum of the number of outgoing edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since out-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.outDegreeCentralityAsync(graph);
       promise.thenCompose(degree -> graph.queryPgqlAsync(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • outDegreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> outDegreeCentralityAsync(PgxGraph graph, VertexProperty<ID,Integer> dc)

      Out-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Out-Degree centrality returns the sum of the number of outgoing edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since out-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      dc - (out argument) vertex property holding the degree centrality value for each vertex in the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> dc = graph.createVertexProperty(PropertyType.INTEGER);
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.outDegreeCentralityAsync(graph, dc);
       promise.thenCompose(degree -> graph.queryPgqlAsync(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • outDegreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> outDegreeCentralityAsync(PgxGraph graph, String propertyName)
    • inDegreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> inDegreeCentralityAsync(PgxGraph graph)

      In-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      In-Degree centrality returns the sum of the number of incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since in-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.inDegreeCentralityAsync(graph);
       promise.thenCompose(degree -> graph.queryPgqlAsync(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • inDegreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> inDegreeCentralityAsync(PgxGraph graph, VertexProperty<ID,Integer> dc)

      In-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      In-Degree centrality returns the sum of the number of incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since in-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      dc - (out argument) vertex property holding the degree centrality value for each vertex in the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> dc = graph.createVertexProperty(PropertyType.INTEGER);
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.inDegreeCentralityAsync(graph, dc);
       promise.thenCompose(degree -> graph.queryPgqlAsync(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • inDegreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> inDegreeCentralityAsync(PgxGraph graph, String propertyName)
    • degreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> degreeCentralityAsync(PgxGraph graph)

      Degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Degree centrality counts the number of outgoing and incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.degreeCentralityAsync(graph);
       promise.thenCompose(degree -> graph.queryPgqlAsync(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • degreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> degreeCentralityAsync(PgxGraph graph, VertexProperty<ID,Integer> dc)

      Degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Degree centrality counts the number of outgoing and incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      dc - (out argument) vertex property holding the degree centrality value for each vertex in the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> dc = graph.createVertexProperty(PropertyType.INTEGER);
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.degreeCentralityAsync(graph, dc);
       promise.thenCompose(degree -> graph.queryPgqlAsync(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • degreeCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> degreeCentralityAsync(PgxGraph graph, String propertyName)
    • harmonicCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> harmonicCentralityAsync(PgxGraph graph)

      Harmonic centrality measures node importance by considering the reciprocal of the sum of shortest path distances in the network.

      Definition

      Harmonic centrality computes the centrality of each vertex by taking the reciprocal of the sum of the shortest path distances from that vertex to all other vertices in the graph. This metric highlights the importance of vertices that efficiently connect disparate parts of the network

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Harmonic centrality can be applied in transportation networks to identify critical nodes that facilitate efficient travel between different destinations.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the harmonic centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Long, Double>> promise = analyst.harmonicCentralityAsync(graph);
       promise.thenCompose(harmonicC -> graph.queryPgqlAsync(
         "SELECT x, x." + harmonicC.getName() + "FROM MATCH (x) "))
         .thenAccept(PgqlResultSet::print);
       
       
    • harmonicCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> harmonicCentralityAsync(PgxGraph graph, VertexProperty<ID,Double> hc)

      Harmonic centrality measures node importance by considering the reciprocal of the sum of shortest path distances in the network.

      Definition

      Harmonic centrality computes the centrality of each vertex by taking the reciprocal of the sum of the shortest path distances from that vertex to all other vertices in the graph. This metric highlights the importance of vertices that efficiently connect disparate parts of the network

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Harmonic centrality can be applied in transportation networks to identify critical nodes that facilitate efficient travel between different destinations.
      Parameters:
      graph - the graph.
      hc - (out argument) vertex property holding the harmonic centrality value for each vertex in the graph.
      Returns:
      vertex property holding the harmonic centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Long, Double> hc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Long, Double>> promise = analyst.harmonicCentralityAsync(graph, hc);
       promise.thenCompose(harmonicC -> graph.queryPgqlAsync(
         "SELECT x, x." + harmonicC.getName() + "FROM MATCH (x) "))
         .thenAccept(PgqlResultSet::print);
       
       
    • harmonicCentralityAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> harmonicCentralityAsync(PgxGraph graph, String propertyName)
    • adamicAdarCountingAsync

      public PgxFuture<EdgeProperty<Double>> adamicAdarCountingAsync(PgxGraph graph)

      The adamic-adar index compares the amount of neighbors shared between vertices, this measure can be used with communities.

      Definition

      The Adamic-Adar index is meant for undirected graphs, since it is computed using the degree of the shared neighbors by two vertices in the graph. This implementation is intended for undirected graphs and computes the index for every pair of vertices connected by an edge and associates it with that edge.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(E) with E = number of edges

      Default Values

      Applications

      • The Adamic-Adar index can be used to find correlations between groups of people in social networks, thus characterize communities and also infer potential new links between them.
      Parameters:
      graph - the graph.
      Returns:
      edge property holding the Adamic-Adar index of each edge in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<EdgeProperty<Double>> promise = analyst.adamicAdarCountingAsync(graph);
       promise.thenCompose(adamicAdar -> graph.queryPgqlAsync(
         "SELECT x, x." + adamicAdar.getName() + " MATCH (x) ORDER BY x." + adamicAdar.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • adamicAdarCountingAsync

      public PgxFuture<EdgeProperty<Double>> adamicAdarCountingAsync(PgxGraph graph, EdgeProperty<Double> aa)

      The adamic-adar index compares the amount of neighbors shared between vertices, this measure can be used with communities.

      Definition

      The Adamic-Adar index is meant for undirected graphs, since it is computed using the degree of the shared neighbors by two vertices in the graph. This implementation is intended for undirected graphs and computes the index for every pair of vertices connected by an edge and associates it with that edge.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(E) with E = number of edges

      Default Values

      Applications

      • The Adamic-Adar index can be used to find correlations between groups of people in social networks, thus characterize communities and also infer potential new links between them.
      Parameters:
      graph - the graph.
      aa - (out argument) edge property holding the Adamic-Adar index of each edge in the graph.
      Returns:
      edge property holding the Adamic-Adar index of each edge in the graph.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> aa = graph.createEdgeProperty(PropertyType.DOUBLE);
       PgxFuture<EdgeProperty<Double>> promise = analyst.adamicAdarCountingAsync(graph, aa);
       promise.thenCompose(adamicAdar -> graph.queryPgqlAsync(
         "SELECT x, x." + adamicAdar.getName() + " MATCH (x) ORDER BY x." + adamicAdar.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • randomWalkWithRestartAsync

      public <ID> PgxFuture<PgxMap<PgxVertex<ID>,Integer>> randomWalkWithRestartAsync(PgxGraph graph, PgxVertex<ID> source, int length, double resetProb, PgxMap<PgxVertex<ID>,Integer> visitCount)

      random walk with restart does the what its name says, it can find approximate stationary distributions

      Definition

      This algorithm performs a random walk over the graph. The walk will start at the given source vertex and will randomly visit neighboring vertices in the graph, with a probability equal to the value of reset_probability of going back to the starting point. The random walk will also go back to the starting point every time it reaches a vertex with no outgoing edges. The algorithm will stop once it reaches the specified walk length.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(L) with L = length of the random walk
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • The information gathered from a random walk can be used to approximate stationary distributions when the number of visits is normalized
      Parameters:
      graph - the graph.
      source - (in argument) starting point of the random walk.
      length - (in argument) length (number of steps) of the random walk.
      resetProb - (in argument) probability value for resetting the random walk.
      visitCount - (out argument) map holding the number of visits during the random walk for each vertex in the graph.
      Returns:
      map holding the number of visits during the random walk for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<PgxVertex, Integer> visit_count;
       PgxFuture<PgxMap<PgxVertex, Integer>> promise = analyst.randomWalkWithRestart(graph, 0, 100, 0,6, visit_count);
       
       
      See Also:
    • communitiesLabelPropagationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesLabelPropagationAsync(PgxGraph graph)

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Partition<Integer>> promise = analyst.communitiesLabelPropagationAsync(graph);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesLabelPropagationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesLabelPropagationAsync(PgxGraph graph, int maxIterations)

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      maxIterations - maximum number of iterations that will be performed.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Partition<Integer>> promise = analyst.communitiesLabelPropagationAsync(graph, 100);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesLabelPropagationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesLabelPropagationAsync(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution)

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesLabelPropagationAsync(graph, pd);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesLabelPropagationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesLabelPropagationAsync(PgxGraph graph, int maxIterations, VertexProperty<ID,Long> partitionDistribution)

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      maxIterations - maximum number of iterations that will be performed.
      partitionDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesLabelPropagationAsync(graph, 100, pd);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesConductanceMinimizationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesConductanceMinimizationAsync(PgxGraph graph)

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Partition<Integer>> promise = analyst.communitiesConductanceMinimizationAsync(graph);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesConductanceMinimizationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesConductanceMinimizationAsync(PgxGraph graph, int max)

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      max - maximum number of iterations that will be performed. For most graphs, a maximum of 100 iterations should be enough.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Partition<Integer>> promise = analyst.communitiesConductanceMinimizationAsync(graph, 100);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesConductanceMinimizationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesConductanceMinimizationAsync(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution)

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesConductanceMinimizationAsync(graph, pd);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesConductanceMinimizationAsync

      public <ID> PgxFuture<Partition<ID>> communitiesConductanceMinimizationAsync(PgxGraph graph, int maxIterations, VertexProperty<ID,Long> partitionDistribution)

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      maxIterations - maximum number of iterations that will be performed. For most graphs, a maximum of 100 iterations should be enough.
      partitionDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesConductanceMinimizationAsync(graph, 100, pd);
       promise.thenCompose(conductance -> graph.queryPgqlAsync(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • communitiesInfomapAsync

      public <ID> PgxFuture<Partition<ID>> communitiesInfomapAsync(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight)

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesInfomapAsync(graph, rank, weight);
       partition = promise.get()
       first_component = partition.getPartitionByIndex(0)
       
       
    • communitiesInfomapAsync

      public <ID> PgxFuture<Partition<ID>> communitiesInfomapAsync(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight, double tau, double tol, int maxIter)

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      tau - damping factor.
      tol - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesInfomapAsync(graph, rank, weight, 0.15, 0.0001, 10);
       partition = promise.get()
       first_component = partition.getPartitionByIndex(0)
       
       
    • communitiesInfomapAsync

      public <ID> PgxFuture<Partition<ID>> communitiesInfomapAsync(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight, VertexProperty<ID,Long> module)

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      module - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesInfomapAsync(graph, rank, weight, module);
       partition = promise.get()
       first_component = partition.getPartitionByIndex(0)
       
       
    • communitiesInfomapAsync

      public <ID> PgxFuture<Partition<ID>> communitiesInfomapAsync(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight, double tau, double tol, int maxIter, VertexProperty<ID,Long> module)

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      tau - damping factor.
      tol - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      module - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.communitiesInfomapAsync(graph, rank, weight, 0.15, 0.0001,
          10, module);
       partition = promise.get()
       first_component = partition.getPartitionByIndex(0)
       
       
    • louvainAsync

      public <ID> PgxFuture<VertexProperty<ID,Long>> louvainAsync(PgxGraph graph, EdgeProperty<Double> weight, int maxIter, int nbrPass, double tol, VertexProperty<ID,Long> community)

      Louvain can detect communities in a large graph relatively fast.

      Definition

      Louvain is an algorithm for community detection in large graphs which uses the graph's modularity. Initially it assigns a different community to each node of the graph. It then iterates over the nodes and evaluates for each node the modularity gain obtained by removing the node from its community and placing it in the community of one of its neighbors. The node is placed in the community for which the modularity gain is maximum. This process is repeated for all nodes until no improvement is possible, i.e until no new assignment of a node to a different community can improve the graph's modularity.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(8 * V + E) with V = number of vertices

      Default Values

      Applications

      • The Louvain algorithm can be used for community detection in a multiple real-life situations, like identifying cyber-communities in a social network.
      Parameters:
      graph - the graph.
      weight - weights of the edges of the graph.
      maxIter - maximum number of iterations that will be performed during each pass.
      nbrPass - number of passes that will be performed.
      tol - maximum tolerated error value. The algorithm will stop once the graph's total modularity gain becomes smaller than this value.
      community - the community ID assigned to each node.
      Returns:
      the community ID assigned to each node.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Long, Long> community = graph.createVertexProperty(PropertyType.LONG,"COMMUNITY");
       var result= analyst.louvain(graph, weight, 100, 10, 0.001, community);
       
       
    • louvainAsync

      public <ID> PgxFuture<VertexProperty<ID,Long>> louvainAsync(PgxGraph graph, EdgeProperty<Double> weight, int maxIter)

      Louvain can detect communities in a large graph relatively fast.

      Definition

      Louvain is an algorithm for community detection in large graphs which uses the graph's modularity. Initially it assigns a different community to each node of the graph. It then iterates over the nodes and evaluates for each node the modularity gain obtained by removing the node from its community and placing it in the community of one of its neighbors. The node is placed in the community for which the modularity gain is maximum. This process is repeated for all nodes until no improvement is possible, i.e until no new assignment of a node to a different community can improve the graph's modularity.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(8 * V + E) with V = number of vertices

      Default Values

      Applications

      • The Louvain algorithm can be used for community detection in a multiple real-life situations, like identifying cyber-communities in a social network.
      Parameters:
      graph - the graph.
      weight - weights of the edges of the graph.
      maxIter - maximum number of iterations that will be performed during each pass.
      Returns:
      the community ID assigned to each node.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Long, Long> community = analyst.louvain(graph, weight, 100);
       
       
    • louvainAsync

      public <ID> PgxFuture<VertexProperty<ID,Long>> louvainAsync(PgxGraph graph, EdgeProperty<Double> weight)

      Louvain can detect communities in a large graph relatively fast.

      Definition

      Louvain is an algorithm for community detection in large graphs which uses the graph's modularity. Initially it assigns a different community to each node of the graph. It then iterates over the nodes and evaluates for each node the modularity gain obtained by removing the node from its community and placing it in the community of one of its neighbors. The node is placed in the community for which the modularity gain is maximum. This process is repeated for all nodes until no improvement is possible, i.e until no new assignment of a node to a different community can improve the graph's modularity.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(8 * V + E) with V = number of vertices

      Default Values

      Applications

      • The Louvain algorithm can be used for community detection in a multiple real-life situations, like identifying cyber-communities in a social network.
      Parameters:
      graph - the graph.
      weight - weights of the edges of the graph.
      Returns:
      the community ID assigned to each node.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Long, Long> community = analyst.louvain(graph, weight);
       
       
    • speakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> speakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      Returns:
      distinct vertex labels which meet the threshold parameter.

      Examples

       
       PgxGraph graph = ...;
       String labelsPropName = "...";
       PgxFuture<VertexProperty<ID, String>> resultProp = analyst.speakerListenerLabelPropagationAsync(graph,
        labelsPropName);
       
       
    • speakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> speakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      Returns:
      distinct vertex labels which meet the threshold parameter.

      Examples

       
       PgxGraph graph = ...;
       String labelsPropName = "...";
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> resultProp = analyst.speakerListenerLabelPropagationAsync(graph, maxIter,
        threshold, delimiter, memPropName, labelsPropName);
       
       
    • speakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> speakerListenerLabelPropagationAsync(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labels - distinct vertex labels which meet the threshold parameter.
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      Returns:
      distinct vertex labels which meet the threshold parameter.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> labels = analyst.speakerListenerLabelPropagationAsync(graph, labels,
        maxIter, threshold, delimiter);
       
       
    • weightedSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> weightedSpeakerListenerLabelPropagationAsync(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant uses the edges weight to find those communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labels -
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      weight - edge property holding the weight of each edge in the graph.
      Returns:

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> labels = analyst.weightedSpeakerListenerLabelPropagationAsync(graph, labels,
        maxIter, threshold, delimiter, weight);
       
       
    • weightedSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> weightedSpeakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant uses the edges weight to find those communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      weight - edge property holding the weight of each edge in the graph.
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       String labelsPropName = "...";
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> resultProp = analyst.weightedSpeakerListenerLabelPropagationAsync(graph,
        labelsPropName, maxIter, threshold, delimiter, weight);
       
       
    • weightedSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> weightedSpeakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName, EdgeProperty<Double> weight)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant uses the edges weight to find those communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      weight - edge property holding the weight of each edge in the graph.
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       String labelsPropName = "...";
       PgxFuture<VertexProperty<ID, String>> resultProp = analyst.weightedSpeakerListenerLabelPropagationAsync(graph,
        labelsPropName, weight);
       
       
    • filteredSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> filteredSpeakerListenerLabelPropagationAsync(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter, EdgeFilter filter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labels -
      maxIter -
      threshold -
      delimiter -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> labels = analyst.filteredSpeakerListenerLabelPropagationAsync(graph, labels,
        maxIter, threshold, delimiter, filter);
       
       
    • filteredSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> filteredSpeakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter, EdgeFilter filter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      maxIter -
      threshold -
      delimiter -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       String labelsPropName = "...";
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> labels = analyst.filteredSpeakerListenerLabelPropagationAsync(graph,
        labelsPropName, maxIter, threshold, delimiter, filter);
       
       
    • filteredSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> filteredSpeakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName, EdgeFilter filter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       String labelsPropName = "...";
       PgxFuture<VertexProperty<ID, String>> resultProp = analyst.filteredSpeakerListenerLabelPropagationAsync(graph,
        labelsPropName, filter);
       
       
    • filteredWeightedSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> filteredWeightedSpeakerListenerLabelPropagationAsync(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight, EdgeFilter filter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to and uses the edges' weight to update the frequency of listened labels.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labels -
      maxIter -
      threshold -
      delimiter -
      weight -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 3.0");
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> labels = analyst.filteredWeightedSpeakerListenerLabelPropagationAsync(graph,
        labels, maxIter, threshold, delimiter, weight, filter);
       
       
    • filteredWeightedSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> filteredWeightedSpeakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight, EdgeFilter filter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to and uses the edges' weight to update the frequency of listened labels.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      maxIter -
      threshold -
      delimiter -
      weight -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 3.0");
       String labelsPropName = "...";
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       PgxFuture<VertexProperty<ID, String>> resultProp = analyst.filteredWeightedSpeakerListenerLabelPropagationAsync(
        graph, labelsPropName, maxIter, threshold, delimiter, weight, filter);
       
       
    • filteredWeightedSpeakerListenerLabelPropagationAsync

      public <ID> PgxFuture<VertexProperty<ID,String>> filteredWeightedSpeakerListenerLabelPropagationAsync(PgxGraph graph, String labelsPropName, EdgeProperty<Double> weight, EdgeFilter filter)

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to and uses the edges' weight to update the frequency of listened labels.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      weight -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 3.0");
       String labelsPropName = "...";
       PgxFuture<VertexProperty<ID, String>> resultProp = analyst.filteredWeightedSpeakerListenerLabelPropagationAsync(
        graph, labelsPropName, weight, filter);
       
       
    • conductanceAsync

      public <ID> PgxFuture<Scalar<Double>> conductanceAsync(PgxGraph graph, Partition<ID> partition, long partitionIndex)

      Conductance assesses the quality of a partition in a graph

      Definition

      Conductance in a graph is computed for a specific cut of it. A cut is a partition of the graph into two subsets (components), disconnecting the graph if the edges from the cut are removed. Thus the algorithm requires a labeling for the vertices in the different subsets of the graph, then the conductance is computed by the ratio of the edges belonging to the given cut (i.e. the edges that split the graph into disconnected components) and the edges belonging to each of these subsets. If there is more than one cut (or partition), this implementation will take the given component number as reference to compute the conductance associated with that particular cut.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(1)

      Default Values

      • num: 0

      Applications

      • Conductance can be used to measure how well connected a graph is, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      partitionIndex - number of the component to be used for computing its conductance.
      Returns:
      Scalar (double) to store the conductance value of the given cut.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       PgxFuture<Scalar<Double>> promise = analyst.conductanceAsync(graph, partition, 0);
       promise.thenAccept(conductance -> {
         conductance.get();
       });
       
       
      See Also:
    • conductanceAsync

      public <ID> PgxFuture<Scalar<Double>> conductanceAsync(PgxGraph graph, Partition<ID> partition, long partitionIndex, Scalar<Double> conductance)

      Conductance assesses the quality of a partition in a graph

      Definition

      Conductance in a graph is computed for a specific cut of it. A cut is a partition of the graph into two subsets (components), disconnecting the graph if the edges from the cut are removed. Thus the algorithm requires a labeling for the vertices in the different subsets of the graph, then the conductance is computed by the ratio of the edges belonging to the given cut (i.e. the edges that split the graph into disconnected components) and the edges belonging to each of these subsets. If there is more than one cut (or partition), this implementation will take the given component number as reference to compute the conductance associated with that particular cut.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(1)

      Default Values

      • num: 0

      Applications

      • Conductance can be used to measure how well connected a graph is, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      partitionIndex - number of the component to be used for computing its conductance.
      conductance - Scalar (double) to store the conductance value of the given cut.
      Returns:
      Scalar (double) to store the conductance value of the given cut.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Double> scalar = graph.createScalar(PropertyType.DOUBLE);
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       PgxFuture<Scalar<Double>> promise = analyst.conductanceAsync(graph, partition, 0, scalar);
       promise.thenAccept(conductance -> {
         conductance.get();
       });
       
       
      See Also:
    • partitionConductanceAsync

      public <ID> PgxFuture<Pair<Scalar<Double>,Scalar<Double>>> partitionConductanceAsync(PgxGraph graph, Partition<ID> partition)

      Partition conductance assesses the quality of many partitions in a graph

      Definition

      This variant of the conductance algorithm will compute the conductance for the given number of components, returning an output with the minimum value of conductance found from the corresponding partitions and their average conductance value.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(1)

      Default Values

      Applications

      • Conductance can be used to measure how well connected is a graph, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      Returns:
      Pair with two scalars, the first one with the value of the average conductance, and the second with minimun conductance value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       PgxFuture<Pair<Scalar<Double>, Scalar<Double>>> promise = analyst.partitionConductanceAsync(graph, partition);
       promise.thenAccept(coductance -> {
         coductance.getFirst().get();
         coductance.getSecond().get();
       });
       
       
    • partitionConductanceAsync

      public <ID> PgxFuture<Pair<Scalar<Double>,Scalar<Double>>> partitionConductanceAsync(PgxGraph graph, Partition<ID> partition, Scalar<Double> avgConductance, Scalar<Double> minConductance)

      Partition conductance assesses the quality of many partitions in a graph

      Definition

      This variant of the conductance algorithm will compute the conductance for the given number of components, returning an output with the minimum value of conductance found from the corresponding partitions and their average conductance value.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(1)

      Default Values

      Applications

      • Conductance can be used to measure how well connected is a graph, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      avgConductance - Scalar that will get updated with the computed average conductance value.
      minConductance - Scalar that will get updated with the computed minimum conductance value.
      Returns:
      Pair with two scalars, the first one with the value of the average conductance, and the second with minimun conductance value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Scalar<Double> avgConductance = graph.createScalar(PropertyType.DOUBLE);
       Scalar<Double> minConductance = graph.createScalar(PropertyType.DOUBLE);
       PgxFuture<Pair<Scalar<Double>, Scalar<Double>>> promise = analyst.partitionConductanceAsync(
         graph, partition, avgConductance, minConductance);
       promise.thenAccept(coductance -> {
         coductance.getFirst().get();
         coductance.getSecond().get();
       });
       
       
    • partitionModularityAsync

      public <ID> PgxFuture<Scalar<Double>> partitionModularityAsync(PgxGraph graph, Partition<ID> partition)

      Modularity summarizes information about the quality of components in a graph

      Definition

      Modularity in a graph is a measure for assessing the quality of the partition induced by the components (or community structures) within the graph found by any clustering algorithm (e.g. label propagation, Infomap, WCC, etc.). It compares the number of the edges between the vertices within a component against the expected number of edges if these were generated at random (assuming a uniform probability distribution). A positive modularity value means that, on average, there are more edges within the components than the amount expected (meaning stronger components), and vice-versa for a negative modularity value. This implementation is intended for directed graphs.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E * c) with E = number of edges, c = number of components
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since modularity help to assess the quality of communities in a graph, it can be used in optimization processes when detecting them in other algorithms.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      Returns:
      Scalar (double) with the modularity value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       PgxFuture<Scalar<Double>> promise = analyst.partitionModularityAsync(graph, partition);
       promise.thenAccept(modularity -> {
         modularity.get();
       });
       
       
    • partitionModularityAsync

      public <ID> PgxFuture<Scalar<Double>> partitionModularityAsync(PgxGraph graph, Partition<ID> partition, Scalar<Double> modularity)

      Modularity summarizes information about the quality of components in a graph

      Definition

      Modularity in a graph is a measure for assessing the quality of the partition induced by the components (or community structures) within the graph found by any clustering algorithm (e.g. label propagation, Infomap, WCC, etc.). It compares the number of the edges between the vertices within a component against the expected number of edges if these were generated at random (assuming a uniform probability distribution). A positive modularity value means that, on average, there are more edges within the components than the amount expected (meaning stronger components), and vice-versa for a negative modularity value. This implementation is intended for directed graphs.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E * c) with E = number of edges, c = number of components
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since modularity help to assess the quality of communities in a graph, it can be used in optimization processes when detecting them in other algorithms.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      modularity - Scalar (double) to store the modularity value.
      Returns:
      Scalar (double) with the modularity value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Scalar<Double> scalar = graph.createScalar(PropertyType.DOUBLE);
       PgxFuture<Scalar<Double>> promise = analyst.partitionModularityAsync(graph, partition, scalar);
       promise.thenAccept(modularity -> {
         modularity.get();
       });
       
       
    • partitionModularityAsync

      public <ID> PgxFuture<Scalar<Double>> partitionModularityAsync(PgxGraph graph, Partition<ID> partition, String modularityName)
    • sccKosarajuAsync

      public <ID> PgxFuture<Partition<ID>> sccKosarajuAsync(PgxGraph graph)

      Kosaraju finds strongly connected components in a graph

      Definition

      Kosaraju's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS and BFS features.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Partition<Integer>> promise = analyst.sccKosarajuAsync(graph);
       promise.thenCompose(scc -> graph.queryPgqlAsync(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • sccKosarajuAsync

      public <ID> PgxFuture<Partition<ID>> sccKosarajuAsync(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution)

      Kosaraju finds strongly connected components in a graph

      Definition

      Kosaraju's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS and BFS features.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the SCC assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.sccKosarajuAsync(graph, pd);
       promise.thenCompose(scc -> graph.queryPgqlAsync(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • sccTarjanAsync

      public <ID> PgxFuture<Partition<ID>> sccTarjanAsync(PgxGraph graph)

      Tarjan finds strongly connected components in a graph

      Definition

      Tarjan's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Partition<Integer>> promise = analyst.sccTarjanAsync(graph);
       promise.thenCompose(scc -> graph.queryPgqlAsync(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • sccTarjanAsync

      public <ID> PgxFuture<Partition<ID>> sccTarjanAsync(PgxGraph graph, VertexProperty<ID,Long> partitonDistribution)

      Tarjan finds strongly connected components in a graph

      Definition

      Tarjan's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      partitonDistribution - vertex property holding the label of the SCC assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.sccTarjanAsync(graph, pd);
       promise.thenCompose(scc -> graph.queryPgqlAsync(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • wccAsync

      public <ID> PgxFuture<Partition<ID>> wccAsync(PgxGraph graph)

      Identifying weakly connected components can be useful for clustering graph data

      Definition

      This algorithm finds weakly connected components (WCC) in a directed graph. A WCC is a maximal subset of vertices of the graph with the particular characteristic that for every pair of vertices U and V in the WCC there must be a path connecting U to V, ignoring the direction of edges. It is a non-deterministic algorithm because of its parallelized implementation.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * d) with d = diameter of the graph
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and analysis in social networks.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Partition<Integer>> promise = analyst.wccAsync(graph);
       promise.thenCompose(wcc -> graph.queryPgqlAsync(
         "SELECT x, x." + wcc.getPropertyName() + " MATCH (x) ORDER BY x." + wcc.getPropertyName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • wccAsync

      public <ID> PgxFuture<Partition<ID>> wccAsync(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution)

      Identifying weakly connected components can be useful for clustering graph data

      Definition

      This algorithm finds weakly connected components (WCC) in a directed graph. A WCC is a maximal subset of vertices of the graph with the particular characteristic that for every pair of vertices U and V in the WCC there must be a path connecting U to V, ignoring the direction of edges. It is a non-deterministic algorithm because of its parallelized implementation.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * d) with d = diameter of the graph
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and analysis in social networks.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the WCC assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Partition<Integer>> promise = analyst.wccAsync(graph, pd);
       promise.thenCompose(wcc -> graph.queryPgqlAsync(
         "SELECT x, x." + wcc.getPropertyName() + " MATCH (x) ORDER BY x." + wcc.getPropertyName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • wccAsync

      public <ID> PgxFuture<Partition<ID>> wccAsync(PgxGraph graph, String partitonDistributionName)
    • salsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> salsaAsync(BipartiteGraph graph)

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.salsaAsync(graph);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • salsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> salsaAsync(BipartiteGraph graph, double maxDiff, int maxIter)

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.salsaAsync(graph, 0.001, 100);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • salsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> salsaAsync(BipartiteGraph graph, VertexProperty<ID,Double> salsaRank)

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(Property.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.salsaAsync(graph, rank);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • salsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> salsaAsync(BipartiteGraph graph, double maxDiff, int maxIter, VertexProperty<ID,Double> salsaRank)

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(Property.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.salsaAsync(graph, 0.001, 100, rank);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, PgxVertex<ID> v)

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(graph, vertex);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, PgxVertex<ID> v, double d, int maxIter, double maxDiff)

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(
         graph, vertex, 0.85, 100, 0.001);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, PgxVertex<ID> v, VertexProperty<ID,Double> salsaRank)

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(graph, vertex, rank);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, PgxVertex<ID> v, double d, int maxIter, double maxDiff, VertexProperty<ID,Double> salsaRank)

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(
         graph, vertex, 0.85, 100, 0.001, rank);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, VertexSet<ID> vertices)

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(graph, vertices);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, VertexSet<ID> vertices, double d, int maxIter, double maxDiff)

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(
         graph, vertices, 0.85, 100, 0.001);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, VertexSet<ID> vertices, double d, int maxIter, double maxDiff, VertexProperty<ID,Double> salsaRank)

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(
         graph, vertices, 0.85, 100, 0.001, rank);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • personalizedSalsaAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> personalizedSalsaAsync(BipartiteGraph graph, VertexSet<ID> vertices, VertexProperty<ID,Double> salsaRank)

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.personalizedSalsaAsync(graph, vertices, rank);
       promise.thenCompose(salsa -> graph.queryPgqlAsync(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex, int topK)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex, 100);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex, 100, 500);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex, VertexSequence<ID> hubs, VertexSequence<ID> authorities)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> authorities = graph.createVertexSequence();
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex, hubs, authorities);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex, int topK, VertexSequence<ID> hubs, VertexSequence<ID> authorities)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> authorities = graph.createVertexSequence();
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex, 100, hubs, authorities);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust, VertexSequence<ID> hubs, VertexSequence<ID> authorities)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> authorities = graph.createVertexSequence();
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex, 100, 500, hubs, authorities);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust, int maxIter, double tol, double dampingFactor, int salsaMaxIter, double salsaTol)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      maxIter - maximum number of iterations that will be performed for the Pagerank stage.
      tol - maximum tolerated error value for the Pagerank stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      dampingFactor - damping factor for the Pagerank stage.
      salsaMaxIter - maximum number of iterations that will be performed for the SALSA stage.
      salsaTol - maximum tolerated error value for the SALSA stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex, 100, 500, 100, 0.001, 0.85, 100, 0.001);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • whomToFollowAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,VertexSequence<ID>>> whomToFollowAsync(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust, int maxIter, double tol, double dampingFactor, int salsaMaxIter, double salsaTol, VertexSequence<ID> hubs, VertexSequence<ID> authorities)

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      maxIter - maximum number of iterations that will be performed for the Pagerank stage.
      tol - maximum tolerated error value for the Pagerank stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      dampingFactor - damping factor for the Pagerank stage.
      salsaMaxIter - maximum number of iterations that will be performed for the SALSA stage.
      salsaTol - maximum tolerated error value for the SALSA stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> authorities = graph.createVertexSequence();
       PgxFuture<Pair<VertexSequence<Integer>, VertexSequence<Integer>>> promise = analyst.whomToFollowAsync(
         graph, vertex, 100, 500, 100, 0.001, 0.85, 100, 0.001, hubs, authorities);
       promise.thenAccept(wtf -> {
         wtf.getFirst();
         wtf.getSecond();
       });
       
       
    • matrixFactorizationGradientDescentAsync

      public <ID> PgxFuture<MatrixFactorizationModel<ID>> matrixFactorizationGradientDescentAsync(BipartiteGraph graph, EdgeProperty<Double> weight)

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<MatrixFactorizationModel<Integer>> promise = analyst.matrixFactorizationGradientDescentAsync(
         graph, cost);
       promise.thenAccept(matrix -> {
         matrix.getRootMeanSquareError();
       });
       
       
      See Also:
    • matrixFactorizationGradientDescentAsync

      public <ID> PgxFuture<MatrixFactorizationModel<ID>> matrixFactorizationGradientDescentAsync(BipartiteGraph graph, EdgeProperty<Double> weight, double learningRate, double changePerStep, double lambda, int maxStep, int vectorLength)

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      learningRate - learning rate for the optimization process.
      changePerStep - parameter used to modulate the learning rate during the optimization process.
      lambda - penalization parameter to avoid overfitting during optimization process.
      maxStep - maximum number of iterations that will be performed.
      vectorLength - size of the feature vectors to be generated for the factorization.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<MatrixFactorizationModel<Integer>> promise = analyst.matrixFactorizationGradientDescentAsync(
         graph, cost, 0.1, 0.9, 0.1, 100, 20);
       promise.thenAccept(matrix -> {
         matrix.getRootMeanSquareError();
       });
       
       
      See Also:
    • matrixFactorizationGradientDescentAsync

      public <ID> PgxFuture<MatrixFactorizationModel<ID>> matrixFactorizationGradientDescentAsync(BipartiteGraph graph, EdgeProperty<Double> weight, VertexProperty<ID,PgxVect<Double>> features)

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      features - (out argument) vertex property holding the generated feature vectors for each vertex.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVect<Double>> features = graph.createVertexVectorProperty(PropertyType.DOUBLE, 20);
       PgxFuture<MatrixFactorizationModel<Integer>> promise = analyst.matrixFactorizationGradientDescentAsync(
         graph, cost, features);
       promise.thenAccept(matrix -> {
         matrix.getRootMeanSquareError();
       });
       
       
      See Also:
    • matrixFactorizationGradientDescentAsync

      public <ID> PgxFuture<MatrixFactorizationModel<ID>> matrixFactorizationGradientDescentAsync(BipartiteGraph graph, EdgeProperty<Double> weight, double learningRate, double changePerStep, double lambda, int maxStep, int vectorLength, VertexProperty<ID,PgxVect<Double>> features)

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      learningRate - learning rate for the optimization process.
      changePerStep - parameter used to modulate the learning rate during the optimization process.
      lambda - penalization parameter to avoid overfitting during optimization process.
      maxStep - maximum number of iterations that will be performed.
      vectorLength - size of the feature vectors to be generated for the factorization.
      features - (out argument) vertex property holding the generated feature vectors for each vertex.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVect<Double>> features = graph.createVertexVectorProperty(PropertyType.DOUBLE, 20);
       PgxFuture<MatrixFactorizationModel<Integer>> promise = analyst.matrixFactorizationGradientDescentAsync(
         graph, cost, 0.1, 0.9, 0.1, 100, 20, features);
       promise.thenAccept(matrix -> {
         matrix.getRootMeanSquareError();
       });
       
       
      See Also:
    • matrixFactorizationRecommendationsAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> matrixFactorizationRecommendationsAsync(BipartiteGraph graph, PgxVertex<ID> user, int vectorLength, VertexProperty<ID,PgxVect<Double>> feature, VertexProperty<ID,Double> estimatedRating)

      Estimate rating can be used as a prediction algorithm for bipartite graphs

      Definition

      This algorithm is a complement for Matrix Factorization, thus it needs a bipartite graph and the generated feature vectors from such algorithm. The generated feature vectors will be used for making predictions in cases where the given user vertex has not been related to a particular item from the item set. Similarly to the recommendations from matrix factorization, this algorithm will perform dot products between the given user vertex and the rest of vertices in the graph, giving a score of 0 to the items that are already related to the user and to the products with other user vertices, hence returning the results of the dot products for the unrelated item vertices. The scores from those dot products can be interpreted as the predicted scores for the unrelated items given a particular user vertex.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm uses computed feature vectors from Matrix Factorization to make predictions about unrelated vertices from the item set (right vertices in the bipartite graph.
      Parameters:
      graph - the graph.
      user - vertex from the left (user) side of the graph.
      vectorLength - size of the feature vectors.
      feature - vertex property holding the feature vectors for each vertex.
      estimatedRating - (out argument) vertex property holding the estimated rating score for each vertex.
      Returns:
      vertex property holding the estimated rating score for each vertex.
      See Also:
    • fattestPathAsync

      public <ID> PgxFuture<AllPaths<ID>> fattestPathAsync(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity)

      Fattest path is a fast algorithm for finding a shortest path adding constraints for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<AllPaths<Integer>> promise = analyst.fattestPathAsync(graph, root, cost);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • fattestPathAsync

      public <ID> PgxFuture<AllPaths<ID>> fattestPathAsync(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Fattest path is a fast algorithm for finding a shortest path adding constraints for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      distance - (out argument) vertex property holding the capacity value of the fattest path up to the current vertex. The fatness value for the source vertex will be INF, while it will be 0 for all the vertices that are not reachable from the source.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the fattest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.fattestPathAsync(graph, root, cost, distance, parent, parentEdge);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • fattestPathAsync

      public <ID> PgxFuture<AllPaths<ID>> fattestPathAsync(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity, boolean ignoreEdgeDirection)

      Undirected Fattest path is variation of the fattest graph algorithm that ignores edge directions. for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<AllPaths<Integer>> promise = analyst.fattestPathAsync(graph, root, cost, true);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • fattestPathAsync

      public <ID> PgxFuture<AllPaths<ID>> fattestPathAsync(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection)

      Undirected Fattest path is variation of the fattest graph algorithm that ignores edge directions. for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      distance - (out argument) vertex property holding the capacity value of the fattest path up to the current vertex. The fatness value for the source vertex will be INF, while it will be 0 for all the vertices that are not reachable from the source.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the fattest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.fattestPathAsync(graph, root, cost, distance, parent,
           parentEdge, ignoreEdgeDirection);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost)

      Dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraAsync(graph, src, dst, cost);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraAsync(graph, src, dst, cost, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr)

      Filtered Dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraAsync(graph, src, dst, cost, filter);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Filtered Dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraAsync(
         graph, src, dst, cost, filter, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, boolean ignoreEdgeDirection)

      Undirected filtered djkstra is variation of the filtered djkstra's algorithm that ignores edge directions.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path ignoring edges directions for directed graphs while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices .

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraAsync(graph, src, dst, cost, filter);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection)

      Undirected filtered djkstra is variation of the filtered djkstra's algorithm that ignores edge directions.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path ignoring edges directions for directed graphs while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices .

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraAsync(
         graph, src, dst, cost, filter, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, boolean ignoreEdgeDirection)

      Undirected Dijkstra's algorithm is a variant of Dijkstra's algorithm that ignores edge directions.

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraAsync(graph, src, dst, cost);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection)

      Undirected Dijkstra's algorithm is a variant of Dijkstra's algorithm that ignores edge directions.

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraAsync(graph, src, dst, cost, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathMultiDestinationDijkstraAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathMultiDestinationDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost)

      Dijkstra is a fast algorithm for finding a shortest path in a graph and goes to all destinations.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path (if there is one) which goes from a single source to all destinations, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathMultiDestinationDijkstraAsync(graph, src, cost);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathMultiDestinationDijkstraAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathMultiDestinationDijkstraAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Dijkstra is a fast algorithm for finding a shortest path in a graph and goes to all destinations.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path (if there is one) which goes from a single source to all destinations, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      distance - (out argument) vertex property holding the distance to the source vertex for each vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathMultiDestinationDijkstraAsync(graph, src, cost,
        distance, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost)

      Bidirectional dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraBidirectionalAsync(graph, src, dst, cost);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Bidirectional dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraBidirectionalAsync(
         graph, src, dst, cost, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, String parentName, String parentEdgeName)
    • shortestPathDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, boolean ignoreEdgeDirection)

      Undirected bidirectional dijkstra is a variant of bidirectional dijkstra that ignores edge directions

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraBidirectionalAsync(graph, src, dst, cost);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection)

      Undirected bidirectional dijkstra is a variant of bidirectional dijkstra that ignores edge directions

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      parent - (out argument)
      parentEdge - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathDijkstraBidirectionalAsync(
         graph, src, dst, cost, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, String parentName, String parentEdgeName, boolean ignoreEdgeDirection)
    • shortestPathFilteredDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr)

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraBidirectionalAsync(
         graph, src, dst, cost, filter);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraBidirectionalAsync(
         graph, src, dst, cost, filter, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, String parentName, String parentEdgeName)
    • shortestPathFilteredDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, boolean ignoreEdgeDirection)

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraBidirectionalAsync(
         graph, src, dst, cost, filter);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection)

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathFilteredDijkstraBidirectionalAsync(
         graph, src, dst, cost, filter, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathFilteredDijkstraBidirectionalAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathFilteredDijkstraBidirectionalAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, String parentName, String parentEdgeName, boolean ignoreEdgeDirection)
    • shortestPathBellmanFordAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathBellmanFordAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost)

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathBellmanFordAsync(graph, src, cost);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathBellmanFordAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathBellmanFordAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      distance - (out argument) vertex property holding the distance to the source vertex for each vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathBellmanFordAsync(
         graph, src, cost, distance, parent, parentEdge);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathBellmanFordAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathBellmanFordAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, boolean ignoreEdgeDirection)

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathBellmanFordAsync(graph, src, cost, true);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathBellmanFordAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathBellmanFordAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection)

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      distance - (out argument) vertex property holding the distance to the source vertex for each vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathBellmanFordAsync(
         graph, src, cost, distance, parent, parentEdge, true);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathBellmanFordReverseAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathBellmanFordReverseAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost)

      Reversed bellman-ford finds multiple shortest paths at the same time

      Definition

      This variant of the Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices in a reversed fashion using the incoming edges instead of the outgoing, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      cost -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathBellmanFordReverseAsync(graph, src, cost);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathBellmanFordReverseAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathBellmanFordReverseAsync(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Reversed bellman-ford finds multiple shortest paths at the same time

      Definition

      This variant of the Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices in a reversed fashion using the incoming edges instead of the outgoing, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      cost -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathBellmanFordReverseAsync(
         graph, src, cost, distance, parent, parentEdge);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathBellmanFordSingleDestinationAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathBellmanFordSingleDestinationAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost)

      Bellman-ford single destination finds a shortest path in a graph

      Definition

      This variant of Bellman-Ford's algorithm tries the to find the shortest path (if there is one) from a single source to all destination, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0
      • dest: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathBellmanFordSingleDestinationAsync(graph, src, dst, cost);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathBellmanFordSingleDestinationAsync

      public <ID> PgxFuture<PgxPath<ID>> shortestPathBellmanFordSingleDestinationAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Bellman-ford single destination finds a shortest path in a graph

      Definition

      This variant of Bellman-Ford's algorithm tries the to find the shortest path (if there is one) from a single source to all destination, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0
      • dest: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<PgxPath<Integer>> promise = analyst.shortestPathBellmanFordSingleDestinationAsync(graph, src, dst,
        cost, parent, parentEdge);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • shortestPathHopDistAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathHopDistAsync(PgxGraph graph, PgxVertex<ID> src)

      Hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each vertex with respect to the given source vertex in the input and will also return the parent vertex and linking edge for each vertex. The returned information allows to trace back shortest paths from any reachable vertex to the source vertex.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathHopDistAsync(graph, src);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathHopDistAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathHopDistAsync(PgxGraph graph, PgxVertex<ID> src, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each vertex with respect to the given source vertex in the input and will also return the parent vertex and linking edge for each vertex. The returned information allows to trace back shortest paths from any reachable vertex to the source vertex.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathHopDistAsync(graph, src, distance, parent, parentEdge);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathHopDistReverseAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathHopDistReverseAsync(PgxGraph graph, PgxVertex<ID> src)

      Backwards hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathHopDistReverseAsync(graph, src);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathHopDistReverseAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathHopDistReverseAsync(PgxGraph graph, PgxVertex<ID> src, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Backwards hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathHopDistReverseAsync(
         graph, src, distance, parent, parentEdge);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathHopDistUndirectedAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathHopDistUndirectedAsync(PgxGraph graph, PgxVertex<ID> src)

      Undirected hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathHopDistUndirectedAsync(graph, src);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • shortestPathHopDistUndirectedAsync

      public <ID> PgxFuture<AllPaths<ID>> shortestPathHopDistUndirectedAsync(PgxGraph graph, PgxVertex<ID> src, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge)

      Undirected hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxFuture<AllPaths<Integer>> promise = analyst.shortestPathHopDistUndirectedAsync(
         graph, src, distance, parent, parentEdge);
       promise.thenAccept(paths -> {
         ...;
       });
       
       
    • countTrianglesAsync

      public PgxFuture<Long> countTrianglesAsync(PgxGraph graph, boolean sortVerticesByDegree)

      triangle counting gives an overview of the amount of connections between vertices in neighborhoods

      Definition

      This algorithm is intended for directed graphs and will count all the existing triangles on it. To run the algorithm on undirected graphs, use the undirected version.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E ^ 1.5) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Triangles in graphs can be used as a measure of the quality in social networks, they can help to find communities within graphs.
      Parameters:
      graph - the graph.
      sortVerticesByDegree - boolean flag for sorting the nodes by their degree as preprocessing step.
      Returns:
      returns the total number of triangles found.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Long> promise = analyst.countTrianglesAsync(graph, true);
       promise.thenAccept(result -> {
         ...;
       });
       
       
    • kcoreAsync

      public <ID> PgxFuture<Pair<Scalar<Long>,VertexProperty<ID,Long>>> kcoreAsync(PgxGraph graph)

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Pair<Scalar<Long>, VertexProperty<Integer, Long>>> promise = analyst.kcoreAsync(graph);
       promise.thenCompose(kcore -> {
         kcore.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
      See Also:
    • kcoreAsync

      public <ID> PgxFuture<Pair<Scalar<Long>,VertexProperty<ID,Long>>> kcoreAsync(PgxGraph graph, int minCore, int maxCore, Scalar<Long> maxKCore, VertexProperty<ID,Long> kcore)

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      minCore - minimum k-core value.
      maxCore - maximum k-core value.
      maxKCore - Scalar (long) for holding the value of the maximum k-core found by the algorithm.
      kcore - (out argument) vertex property with the largest k-core value for each vertex.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> prop = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Pair<Scalar<Long>, VertexProperty<Integer, Long>>> promise = analyst.kcoreAsync(
         graph, 0, 2147483647, prop);
       promise.thenCompose(kcore -> {
         kcore.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
      See Also:
    • kcoreAsync

      public <ID> PgxFuture<Pair<Scalar<Long>,VertexProperty<ID,Long>>> kcoreAsync(PgxGraph graph, int minCore, int maxCore)

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      minCore - minimum k-core value.
      maxCore - maximum k-core value.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Pair<Scalar<Long>, VertexProperty<Integer, Long>>> promise = analyst.kcoreAsync(graph, 0, 2147483647);
       promise.thenCompose(kcore -> {
         kcore.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
      See Also:
    • kcoreAsync

      public <ID> PgxFuture<Pair<Scalar<Long>,VertexProperty<ID,Long>>> kcoreAsync(PgxGraph graph, Scalar<Long> maxKCore, VertexProperty<ID,Long> kcore)

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      maxKCore - Scalar (long) for holding the value of the maximum k-core found by the algorithm.
      kcore - (out argument) vertex property with the largest k-core value for each vertex.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Long> scalar = graph.createScalar(PropertyType.LONG);
       VertexProperty<Integer, Long> prop = graph.createVertexProperty(PropertyType.LONG);
       PgxFuture<Pair<Scalar<Long>, VertexProperty<Integer, Long>>> promise = analyst.kcoreAsync(
         graph, 0, 2147483647, prop);
       promise.thenCompose(kcore -> {
         kcore.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
      See Also:
    • diameterAsync

      public <ID> PgxFuture<Pair<Scalar<Integer>,VertexProperty<ID,Integer>>> diameterAsync(PgxGraph graph)

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the diameter of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Pair<Scalar<Integer>, VertexProperty<Integer, Integer>>> promise = analyst.diameterAsync(graph);
       promise.thenCompose(diameter -> {
         diameter.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + diameter.getSecond().getName() + " MATCH (x) ORDER BY x." + diameter.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
    • diameterAsync

      public <ID> PgxFuture<Pair<Scalar<Integer>,VertexProperty<ID,Integer>>> diameterAsync(PgxGraph graph, Scalar<Integer> diameter, VertexProperty<ID,Integer> eccentricity)

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      diameter - Scalar (integer) for holding the value of the diameter of the graph.
      eccentricity - (out argument) vertex property holding the eccentricity value for each vertex.
      Returns:
      Pair holding the diameter of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Integer> scalar = graph.createScalar(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> prop = graph.createVertexProperty(PropertyType.INTEGER);
       PgxFuture<Pair<Scalar<Integer>, VertexProperty<Integer, Integer>>> promise = analyst.diameterAsync(
         graph, scalar, prop);
       promise.thenCompose(diameter -> {
         diameter.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + diameter.getSecond().getName() + " MATCH (x) ORDER BY x." + diameter.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
    • radiusAsync

      public <ID> PgxFuture<Pair<Scalar<Integer>,VertexProperty<ID,Integer>>> radiusAsync(PgxGraph graph)

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the radius of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<Pair<Scalar<Integer>, VertexProperty<Integer, Integer>>> promise = analyst.radiusAsync(graph);
       promise.thenCompose(radius -> {
         radius.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + radius.getSecond().getName() + " MATCH (x) ORDER BY x." + radius.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
    • radiusAsync

      public <ID> PgxFuture<Pair<Scalar<Integer>,VertexProperty<ID,Integer>>> radiusAsync(PgxGraph graph, Scalar<Integer> radius, VertexProperty<ID,Integer> eccentricity)

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      radius - Scalar (integer) for holding the value of the radius of the graph.
      eccentricity - (out argument) vertex property holding the eccentricity value for each vertex.
      Returns:
      Pair holding the radius of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Integer> scalar = graph.createScalar(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> prop = graph.createVertexProperty(PropertyType.INTEGER);
       PgxFuture<Pair<Scalar<Integer>, VertexProperty<Integer, Integer>>> promise = analyst.radiusAsync(
         graph, scalar, prop);
       promise.thenCompose(radius -> {
         radius.getFirst().get();
         graph.queryPgqlAsync(
           "SELECT x, x." + radius.getSecond().getName() + " MATCH (x) ORDER BY x." + radius.getSecond().getName() +
           " DESC"))
           .thenAccept(PgqlResultSet::print);
       });
       
       
    • peripheryAsync

      public <ID> PgxFuture<VertexSet<ID>> peripheryAsync(PgxGraph graph)

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexSet<Integer>> promise = analyst.peripheryAsync(graph);
       promise.thenAccept(periphery -> {
         ...
       });
       
       
    • peripheryAsync

      public <ID> PgxFuture<VertexSet<ID>> peripheryAsync(PgxGraph graph, VertexSet<ID> periphery)

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      periphery - (out argument) vertex set holding the vertices from the periphery or center of the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.createVertexSet();
       PgxFuture<VertexSet<Integer>> promise = analyst.peripheryAsync(graph, vertices);
       promise.thenAccept(periphery -> {
         ...;
       });
       
       
    • centerAsync

      public <ID> PgxFuture<VertexSet<ID>> centerAsync(PgxGraph graph)

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexSet<Integer>> promise = analyst.centerAsync(graph);
       promise.thenAccept(center -> {
         ...;
       });
       
       
    • centerAsync

      public <ID> PgxFuture<VertexSet<ID>> centerAsync(PgxGraph graph, VertexSet<ID> center)

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      center - (out argument) vertex set holding the vertices from the periphery or center of the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.createVertexSet();
       PgxFuture<VertexSet<Integer>> promise = analyst.centerAsync(graph, vertices);
       promise.thenAccept(center -> {
         ...;
       });
       
       
    • localClusteringCoefficientAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> localClusteringCoefficientAsync(PgxGraph graph)

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for undirected graphs. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.localClusteringCoefficientAsync(graph);
       promise.thenCompose(lcc -> graph.queryPgqlAsync(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • localClusteringCoefficientAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> localClusteringCoefficientAsync(PgxGraph graph, VertexProperty<ID,Double> lcc)

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for undirected graphs. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      lcc - (out argument)
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> lcc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.localClusteringCoefficientAsync(graph, lcc);
       promise.thenCompose(lcc -> graph.queryPgqlAsync(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • localClusteringCoefficientAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> localClusteringCoefficientAsync(PgxGraph graph, boolean ignoreEdgeDirection)

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for undirected graphs. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.localClusteringCoefficientAsync(graph);
       promise.thenCompose(lcc -> graph.queryPgqlAsync(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • localClusteringCoefficientAsync

      public <ID> PgxFuture<VertexProperty<ID,Double>> localClusteringCoefficientAsync(PgxGraph graph, VertexProperty<ID,Double> lcc, boolean ignoreEdgeDirection)

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for directed graphs and interprets them as undirected. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      lcc - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> lcc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxFuture<VertexProperty<Integer, Double>> promise = analyst.localClusteringCoefficientAsync(graph, lcc);
       promise.thenCompose(lcc -> graph.queryPgqlAsync(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • findCycleAsync

      public <ID> PgxFuture<PgxPath<ID>> findCycleAsync(PgxGraph graph)

      Find cycle looks for any loop in the graph.

      Definition

      This algorithm tries to find a cycle in a directed graph using DFS traversals and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. The algorithm is expensive because it will perform DFS traversals using different vertices as starting points until it explores the whole graph (worst-case scenario), or until it finds a cycle.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(5 * V + E) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<PgxPath<Integer>> promise = analyst.findCycleAsync(graph);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • findCycleAsync

      public <ID> PgxFuture<PgxPath<ID>> findCycleAsync(PgxGraph graph, VertexSequence<ID> nodeSeq, EdgeSequence edgeSeq)

      Find cycle looks for any loop in the graph.

      Definition

      This algorithm tries to find a cycle in a directed graph using DFS traversals and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. The algorithm is expensive because it will perform DFS traversals using different vertices as starting points until it explores the whole graph (worst-case scenario), or until it finds a cycle.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(5 * V + E) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      nodeSeq - (out argument) vertex sequence holding the vertices in the cycle.
      edgeSeq - (out argument) edge sequence holding the edges in the cycle.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       VertexSequence<Integer> nodeSeq = graph.createVertexSequence();
       EdgeSequence edgeSeq = graph.createEdgeSequence();
       PgxFuture<PgxPath<Integer>> promise = analyst.findCycleAsync(graph, nodeSeq, edgeSeq);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • findCycleAsync

      public <ID> PgxFuture<PgxPath<ID>> findCycleAsync(PgxGraph graph, PgxVertex<ID> src)

      Find cycle looks for any loop in the graph.

      Definition

      This implementation tries to find a cycle in a directed graph using the given vertex as starting point for the DFS traversal and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. Restricting the DFS traversal to a single starting point means that some parts of the graph may not get explored.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(4 * V + E) with V = number of vertices, E = number of edges

      Default Values

      • s: 0

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      src - source vertex for the search.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<PgxPath<Integer>> promise = analyst.findCycleAsync(graph, vertex);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • findCycleAsync

      public <ID> PgxFuture<PgxPath<ID>> findCycleAsync(PgxGraph graph, PgxVertex<ID> src, VertexSequence<ID> nodeSeq, EdgeSequence edgeSeq)

      Find cycle looks for any loop in the graph.

      Definition

      This implementation tries to find a cycle in a directed graph using the given vertex as starting point for the DFS traversal and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. Restricting the DFS traversal to a single starting point means that some parts of the graph may not get explored.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(4 * V + E) with V = number of vertices, E = number of edges

      Default Values

      • s: 0

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      src - source vertex for the search.
      nodeSeq - (out argument) vertex sequence holding the vertices in the cycle.
      edgeSeq - (out argument) edge sequence holding the edges in the cycle.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexSequence<Integer> nodeSeq = graph.createVertexSequence();
       EdgeSequence edgeSeq = graph.createEdgeSequence();
       PgxFuture<PgxPath<Integer>> promise = analyst.findCycleAsync(graph, vertex, nodeSeq, edgeSeq);
       promise.thenAccept(path -> {
         path.getPathLengthWithCost();
       });
       
       
    • reachabilityAsync

      public <ID> PgxFuture<Integer> reachabilityAsync(PgxGraph graph, PgxVertex<ID> source, PgxVertex<ID> dest, int maxHops, boolean ignoreEdgeDirection)

      Reachability is a fast way to check if two vertices are reachable from each other.

      Definition

      This algorithm tries to find if the destination vertex is reachable given the source vertex and the maximum hop distance set by the user. The search can be performed in a directed or undirected way. These options may lead to different hop distances, since an undirected search has less restrictions on the possible paths connecting vertices than the directed option. Hence hop distances from an undirected search can be smaller than the ones from the directed cases.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(1)

      Default Values

      Applications

      • Check connectivity between vertices in a graph.
      Parameters:
      graph - the graph.
      source - source vertex for the search.
      dest - destination vertex for the search.
      maxHops - maximum hop distance between the source and destination vertices.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      the number of hops between the vertices. It will return -1 if the vertices are not connected or are not reachable given the condition of the maximum hop distance allowed.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       PgxFuture<Integer> promise = analyst.reachabilityAsync(graph, src, dst, 2, false);
       promise.thenAccept(result -> {
         ...;
       });
       
       
    • topologicalSortAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> topologicalSortAsync(PgxGraph graph)

      Topological sort gives an order of visit for vertices in directed acyclic graphs

      Definition

      Topological sort tries to set an order over the vertices in a graph using the direction of the edges. A directed graph has a topological order if and only if it has no cycles, i.e. it is a directed acyclic graph. The algorithm visits the vertices in a DFS-like fashion to set up their order. The order of the vertices is returned as a vertex property, and the values will be set to -1 if there is a cycle in the graph.

      Implementation Details

      The implementation of this algorithm is sequential due the ordering constraint.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the topological order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.topologicalSortAsync(graph);
       promise.thenCompose(topoSort -> graph.queryPgqlAsync(
         "SELECT x, x." + topoSort.getName() + " WHERE (x) ORDER BY x." + topoSort.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • topologicalSortAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> topologicalSortAsync(PgxGraph graph, VertexProperty<ID,Integer> topoSort)

      Topological sort gives an order of visit for vertices in directed acyclic graphs

      Definition

      Topological sort tries to set an order over the vertices in a graph using the direction of the edges. A directed graph has a topological order if and only if it has no cycles, i.e. it is a directed acyclic graph. The algorithm visits the vertices in a DFS-like fashion to set up their order. The order of the vertices is returned as a vertex property, and the values will be set to -1 if there is a cycle in the graph.

      Implementation Details

      The implementation of this algorithm is sequential due the ordering constraint.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      topoSort - (out argument) vertex property holding the topological order of each vertex.
      Returns:
      vertex property holding the topological order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> topoSort = graph.createVertexProperty(PropertyType.INTEGER);
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.topologicalSortAsync(graph, topoSort);
       promise.thenCompose(topoSort -> graph.queryPgqlAsync(
         "SELECT x, x." + topoSort.getName() + " WHERE (x) ORDER BY x." + topoSort.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • topologicalScheduleAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> topologicalScheduleAsync(PgxGraph graph, VertexSet<ID> source)

      Topological schedule gives an order of visit for the reachable vertices from the source

      Definition

      Topological schedule sets an order over the vertices in a graph based on the proximity these have to the vertices from the given source. The algorithm does a BFS traversal for each vertex from the source set in order to assign the correct scheduling order to all the reachable, even if the graph is undirected or has cycles. The vertices that are not reachable will be assigned a value of -1.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS feature.

      Complexity

      • Time: O(k * (V + E)) with V = number of vertices, E = number of edges, k = size of the source set
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      source - set of vertices to be used as the starting points for the scheduling order.
      Returns:
      vertex property holding the scheduled order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> source = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.topologicalScheduleAsync(graph, source);
       promise.thenCompose(topoSched -> graph.queryPgqlAsync(
         "SELECT x, x." + topoSched.getName() + " WHERE (x) ORDER BY x." + topoSched.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • topologicalScheduleAsync

      public <ID> PgxFuture<VertexProperty<ID,Integer>> topologicalScheduleAsync(PgxGraph graph, VertexSet<ID> source, VertexProperty<ID,Integer> topoSched)

      Topological schedule gives an order of visit for the reachable vertices from the source

      Definition

      Topological schedule sets an order over the vertices in a graph based on the proximity these have to the vertices from the given source. The algorithm does a BFS traversal for each vertex from the source set in order to assign the correct scheduling order to all the reachable, even if the graph is undirected or has cycles. The vertices that are not reachable will be assigned a value of -1.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS feature.

      Complexity

      • Time: O(k * (V + E)) with V = number of vertices, E = number of edges, k = size of the source set
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      source - set of vertices to be used as the starting points for the scheduling order.
      topoSched - (out argument) vertex property holding the scheduled order of each vertex.
      Returns:
      vertex property holding the scheduled order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> source = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Integer> topoSched = graph.createVertexProperty(PropertyType.INTEGER);
       PgxFuture<VertexProperty<Integer, Integer>> promise = analyst.topologicalScheduleAsync(graph, source, topoSched);
       promise.thenCompose(topoSched -> graph.queryPgqlAsync(
         "SELECT x, x." + topoSched.getName() + " WHERE (x) ORDER BY x." + topoSched.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • outDegreeDistributionAsync

      public PgxFuture<PgxMap<Integer,Long>> outDegreeDistributionAsync(PgxGraph graph)

      Out-degree distribution gives information about the outgoing flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the out-degree (i.e. just outgoing edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      Returns:
      map holding a histogram of the node degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<PgxMap<Integer, Long>> promise = analyst.outDegreeDistributionAsync(graph);
       promise.thenAccept(map -> {
         ...;
       });
       
       
    • outDegreeDistributionAsync

      public PgxFuture<PgxMap<Integer,Long>> outDegreeDistributionAsync(PgxGraph graph, PgxMap<Integer,Long> distribution)

      Out-degree distribution gives information about the outgoing flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the out-degree (i.e. just outgoing edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      distribution - (out argument)
      Returns:
      map holding a histogram of the node degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<Integer, Long> distribution = graph.createMap(PropertyType.INTEGER, PropertyType.LONG);
       PgxFuture<PgxMap<Integer, Long>> promise = analyst.outDegreeDistributionAsync(graph, distribution);
       promise.thenAccept(map -> {
         ...;
       });
       
       
    • inDegreeDistributionAsync

      public PgxFuture<PgxMap<Integer,Long>> inDegreeDistributionAsync(PgxGraph graph)

      In-degree distribution gives information about the incoming flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the in-degree (i.e. just incoming edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      Returns:
      map holding a histogram of the vertex degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxFuture<PgxMap<Integer, Long>> promise = analyst.inDegreeDistributionAsync(graph);
       promise.thenAccept(map -> {
         ...;
       });
       
       
    • inDegreeDistributionAsync

      public PgxFuture<PgxMap<Integer,Long>> inDegreeDistributionAsync(PgxGraph graph, PgxMap<Integer,Long> distribution)

      In-degree distribution gives information about the incoming flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the in-degree (i.e. just incoming edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      distribution - (out argument)
      Returns:
      map holding a histogram of the vertex degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<Integer, Long> distribution = graph.createMap(PropertyType.INTEGER, PropertyType.LONG);
       PgxFuture<PgxMap<Integer, Long>> promise = analyst.inDegreeDistributionAsync(graph, distribution);
       promise.thenAccept(map -> {
         ...;
       });
       
       
    • primAsync

      public PgxFuture<EdgeProperty<Boolean>> primAsync(PgxGraph graph, EdgeProperty<Double> weight)

      prim reveals tree structures with shortest paths in a graph

      Definition

      This implementation of Prim's algorithm works on undirected graphs that are connected and have no multi-edges (i.e. more than one edge connecting the same pair of vertices). The algorithm computes the minimum spanning tree (MST) of the graph using the weights associated to each edge. A minimum spanning tree is a subset of the edges that connects all the vertices in the graph such that it minimizes the total weight associated to the edges.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(2 * E + V) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • The trees found with Prim's algorithm can be used to simplify the design of networks when just looking to connect all the elements on the network, like in computer or transportation networks. It can also be used to generate mazes using the structure of a graph.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      edge property holding the edges belonging to the minimum spanning tree of the graph (i.e. all the edges with in_mst=true).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxFuture<EdgeProperty<Boolean>> promise = analyst.primAsync(graph, cost);
       promise.thenCompose(prim -> graph.queryPgqlAsync(
         "SELECT x, x." + prim.getName() + " MATCH (x) ORDER BY x." + prim.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • primAsync

      public PgxFuture<EdgeProperty<Boolean>> primAsync(PgxGraph graph, EdgeProperty<Double> weight, EdgeProperty<Boolean> mst)

      prim reveals tree structures with shortest paths in a graph

      Definition

      This implementation of Prim's algorithm works on undirected graphs that are connected and have no multi-edges (i.e. more than one edge connecting the same pair of vertices). The algorithm computes the minimum spanning tree (MST) of the graph using the weights associated to each edge. A minimum spanning tree is a subset of the edges that connects all the vertices in the graph such that it minimizes the total weight associated to the edges.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(2 * E + V) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • The trees found with Prim's algorithm can be used to simplify the design of networks when just looking to connect all the elements on the network, like in computer or transportation networks. It can also be used to generate mazes using the structure of a graph.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      mst - (out argument) edge property holding the edges belonging to the minimum spanning tree of the graph (i.e. all the edges with in_mst=true).
      Returns:
      edge property holding the edges belonging to the minimum spanning tree of the graph (i.e. all the edges with in_mst=true).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeProperty<Boolean> mst = graph.createEdgeProperty(PropertyType.BOOLEAN);
       PgxFuture<EdgeProperty<Boolean>> promise = analyst.primAsync(graph, cost, mst);
       promise.thenCompose(prim -> graph.queryPgqlAsync(
         "SELECT x, x." + prim.getName() + " MATCH (x) ORDER BY x." + prim.getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root, int maxDepth)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex, 2);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex, navigator);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, int maxDepth)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex, navigator, 2);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex, filter, navigator, true);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex, navigator, true, 2);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex, navigator, true, distance, parent);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredBfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredBfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent)

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredBfsAsync(graph, vertex, navigator, true, 2, distance, parent);
       promise.thenCompose(bfs -> graph.queryPgqlAsync(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root, int maxDepth)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex, 2);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex, filter, navigator);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, int maxDepth)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter filter = VertexFilter.ALL;
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex, filter, navigator, 2);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex, filter, navigator, true);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex, filter, navigator, true, 2);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex, filter, navigator, true, distance, parent);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • filteredDfsAsync

      public <ID> PgxFuture<Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>>> filteredDfsAsync(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent)

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       PgxFuture<Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>>> promise =
         analyst.filteredDfsAsync(graph, vertex, filter, navigator, true, 2, distance, parent);
       promise.thenCompose(dfs -> graph.queryPgqlAsync(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC"))
         .thenAccept(PgqlResultSet::print);
       
       
      Since:
      20.1.0
      See Also:
    • computeHighDegreeVerticesAsync

      public <ID> PgxFuture<Pair<PgxMap<Integer,PgxVertex<ID>>,VertexSet<ID>>> computeHighDegreeVerticesAsync(PgxGraph graph, int k, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices)

      Computes the k vertices with the highest degrees in the graph.

      Definition

      Computes the k vertices with the highest degrees in the graph. The resulting map will contain a mapping with the sorted index to the high-degree vertex with the index.

      Implementation Details

      null

      Complexity

      • Time: O(N log N) with N = number of vertices
      • Space: O(k) with V = number of vertices

      Default Values

      Applications

      • Can be used to compute the vertices with the highest degrees a.k.a. super-vertices. This information can be useful in certain applications.
      Parameters:
      graph - the graph.
      k - number of high-degree vertices to be computed.
      highDegreeVertexMapping - (out-argument) the high-degree vertices.
      highDegreeVertices - (out-argument) the high-degree vertices.
      Returns:
      Pair holding first a map with the top k high-degree vertices and their indices and a second vertex set containing the same vertices.
    • computeHighDegreeVerticesAsync

      public <ID> PgxFuture<Pair<PgxMap<Integer,PgxVertex<ID>>,VertexSet<ID>>> computeHighDegreeVerticesAsync(PgxGraph graph, int k)

      Computes the k vertices with the highest degrees in the graph.

      Definition

      Computes the k vertices with the highest degrees in the graph. The resulting map will contain a mapping with the sorted index to the high-degree vertex with the index.

      Implementation Details

      null

      Complexity

      • Time: O(N log N) with N = number of vertices
      • Space: O(k) with V = number of vertices

      Default Values

      Applications

      • Can be used to compute the vertices with the highest degrees a.k.a. super-vertices. This information can be useful in certain applications.
      Parameters:
      graph - the graph.
      k - number of high-degree vertices to be computed.
      Returns:
      Pair holding first a map with the top k high-degree vertices and their indices and a second vertex set containing the same vertices.
    • createDistanceIndexAsync

      public <ID> PgxFuture<VertexProperty<ID,PgxVect<Integer>>> createDistanceIndexAsync(PgxGraph graph, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices)

      Computes an index with distances to each high-degree vertex.

      Definition

      Computes an index which contains the distance to the given high-degree vertices for every node in the graph.

      Implementation Details

      null

      Complexity

      • Time: O(E * k) with E = number of edges, k <= number of high-degree vertices
      • Space: O(V * k) with V = number of vertices

      Default Values

      Applications

      • The index can be used to speed up certain path-finding algorithms.
      Parameters:
      graph - the graph.
      highDegreeVertexMapping - map containing the high-degree vertices as values and indices from 0 to k as keys.
      highDegreeVertices - a set containing the high-degree vertices.
      Returns:
      A vertex-integer-vector property containing the distances from each high-degree vertex for each vertex in the graph.
    • createDistanceIndexAsync

      public <ID> PgxFuture<VertexProperty<ID,PgxVect<Integer>>> createDistanceIndexAsync(PgxGraph graph, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index)

      Computes an index with distances to each high-degree vertex.

      Definition

      Computes an index which contains the distance to the given high-degree vertices for every node in the graph.

      Implementation Details

      null

      Complexity

      • Time: O(E * k) with E = number of edges, k <= number of high-degree vertices
      • Space: O(V * k) with V = number of vertices

      Default Values

      Applications

      • The index can be used to speed up certain path-finding algorithms.
      Parameters:
      graph - the graph.
      highDegreeVertexMapping - map containing the high-degree vertices as values and indices from 0 to k as keys.
      highDegreeVertices - a set containing the high-degree vertices.
      index - (out-argument) the index containing the distances to each high-degree vertex for all vertices.
      Returns:
      A vertex-integer-vector property containing the distances from each high-degree vertex for each vertex in the graph.
    • limitedShortestPathHopDistAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,EdgeSequence>> limitedShortestPathHopDistAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index, VertexSequence<ID> pathVertices, EdgeSequence pathEdges)

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      pathVertices - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      pathEdges - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
    • limitedShortestPathHopDistAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,EdgeSequence>> limitedShortestPathHopDistAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index)

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
    • limitedShortestPathHopDistFilteredAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,EdgeSequence>> limitedShortestPathHopDistFilteredAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index, EdgeFilter filter, VertexSequence<ID> pathVertices, EdgeSequence pathEdges)

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      filter - filter to be evaluated on the edges when searching for a path.
      pathVertices - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      pathEdges - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
    • limitedShortestPathHopDistFilteredAsync

      public <ID> PgxFuture<Pair<VertexSequence<ID>,EdgeSequence>> limitedShortestPathHopDistFilteredAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index, EdgeFilter filter)

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      filter - filter to be evaluated on the edges when searching for a path.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
    • allReachableVerticesEdgesAsync

      public <ID> PgxFuture<org.apache.commons.lang3.tuple.Triple<VertexSet<ID>,EdgeSet,PgxMap<PgxVertex<ID>,Integer>>> allReachableVerticesEdgesAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int k)

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Definition

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      k - the dimension of the distances property; i.e. number of high-degree vertices.
      Returns:
      a Triple containing a vertex-set with the vertices on the path, an edge-set with the edges on the path and a map containing the distances from the source vertex for each vertex on the path
    • allReachableVerticesEdgesFilteredAsync

      public <ID> PgxFuture<org.apache.commons.lang3.tuple.Triple<VertexSet<ID>,EdgeSet,PgxMap<PgxVertex<ID>,Integer>>> allReachableVerticesEdgesFilteredAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int k, EdgeFilter filter)

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Definition

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      k - the dimension of the distances property; i.e. number of high-degree vertices.
      filter - the filter to be used on edges when searching for a path.
      Returns:
      a Triple containing a vertex-set with the vertices on the path, an edge-set with the edges on the path and a map containing the distances from the source vertex for each vertex on the path
    • enumerateSimplePathsAsync

      public <ID> PgxFuture<org.apache.commons.lang3.tuple.Triple<ScalarSequence<Integer>,VertexSequence<ID>,EdgeSequence>> enumerateSimplePathsAsync(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int k, VertexSet verticesOnPath, EdgeSet edgesOnPath, PgxMap<PgxVertex<ID>,Integer> dist)

      Enumerate all simple paths between the source and destination vertex

      Definition

      Enumerate all simple paths between the source and destination vertex

      Implementation Details

      null

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      k - the dimension of the distances property; i.e. number of high-degree vertices.
      verticesOnPath - the vertices on the path.
      edgesOnPath - the edges on the path.
      dist - map containing the distance from the source vertex for each vertex on a path.
      Returns:
      a Triple containing a sequence containing the path lengths, a vertex-sequence containing the vertices on the paths and an edge-sequence containing the edges on the paths
    • bipartiteCheckAsync

      public <ID> PgxFuture<VertexProperty<ID,Boolean>> bipartiteCheckAsync(PgxGraph graph, VertexProperty<ID,Boolean> isLeft)

      Bipartite check verifies whether are graph is a bipartite graph.

      Definition

      This algorithm checks whether the given directed graph is bipartite. It assumes that all the edges are going in the same direction since the method relies on BFS traversals of the graph. If the graph is bipartite the algorithm will return the side of each vertex in the graph with the is_left vertex property.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals.

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • Checking whether a graph is a bipartite one is important since some other graph algorithms rely on this particular condition.
      Parameters:
      graph - the graph.
      isLeft - vertex property holding the side of each vertex in a bipartite graph (true for left, false for right).
      Returns:
      vertex property holding the side of each vertex in a bipartite graph (true for left, false for right).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Boolean> isLeft = graph.createVertexProperty(PropertyType.BOOLEAN);
       PgxFuture<VertexProperty<Integer, Boolean>> promise = analyst.BipartiteCheck(graph, isLeft);
       
       
      See Also:
    • destroyAsync

      public PgxFuture<Void> destroyAsync()
      Description copied from class: Destroyable
      Requests destruction of this object. After this method returns, the behavior of any method of this class becomes undefined.
      Specified by:
      destroyAsync in class Destroyable
      Returns:
      a future which will be completed once the destruction request finishes.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph, boolean norm) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph, false);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph, double e, double d, int max) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph, 0.001, 0.85, 100);
       PgqlResultSet rs = graph.queryPgql("SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." +
         pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph, double e, double d, int max, boolean norm) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph, 0.001, 0.85, 100, false);
       PgqlResultSet rs = graph.queryPgql("SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." +
         pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph, false, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph, double e, double d, int max, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph, 0.001, 0.85, 100, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerank

      public <ID> VertexProperty<ID,Double> pagerank(PgxGraph graph, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      PageRank is an algorithm that computes ranking scores for the vertices using the network created by the incoming edges in the graph. Thus it is intended for directed graphs, although undirected graphs can be treated as well by converting them into directed graphs with reciprocated edges (i.e. keeping the original edge and creating a second one going in the opposite direction). The edges on the graph will define the relevance of each vertex in the graph, reflecting this on the scores, meaning that greater scores will correspond to vertices with greater relevance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.pagerank(graph, 0.001, 0.85, 100, false, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerankApproximate

      public <ID> VertexProperty<ID,Double> pagerankApproximate(PgxGraph graph) throws ExecutionException, InterruptedException

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> pagerank = analyst.pagerankApproximate(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerankApproximate

      public <ID> VertexProperty<ID,Double> pagerankApproximate(PgxGraph graph, double e, double d, int max) throws ExecutionException, InterruptedException

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> pagerank = analyst.pagerankApproximate(graph, 0.001, 0.85, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerankApproximate

      public <ID> VertexProperty<ID,Double> pagerankApproximate(PgxGraph graph, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.pagerankApproximate(graph, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • pagerankApproximate

      public <ID> VertexProperty<ID,Double> pagerankApproximate(PgxGraph graph, double e, double d, int max, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Faster, but less accurate than pagerank. It compares and spots out important vertices in a graph

      Definition

      This variant of the PageRank algorithm computes the ranking scores for the vertices in similar way to the classic algorithm without normalization and with a more relaxed convergence criteria, since the tolerated error value is compared against each single vertex in the graph, instead of looking at the cumulative vertex error. Thus this variant will converge faster than the classic algorithm, but the ranking values might not be as accurate as in the classic implementation.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ranking values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • PageRank can be used to measure the relative importance of documents which are linked together, such as the World Wide Web. The computed rank represents a probability distribution of the likelihood that a person randomly clicking on links will arrive at any particular page.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.pagerankApproximate(graph, 0.001, 0.85, 100, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertex);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v, boolean norm) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertex, false);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertex, 0.001, 0.85, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertex, 0.001, 0.85, 100, false);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertex, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertex, false, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertex, 0.001, 0.85, 100, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a vertex of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedPagerank(graph, vertex, 0.001, 0.85, 100, false, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, boolean norm, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, false, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, double e, double d, int max, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, 0.001, 0.85, 100, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, double e, double d, int max, boolean norm, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, 0.001, 0.85, 100, false, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, false, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, double e, double d, int max, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, 0.001, 0.85, 100, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedPagerank

      public <ID> VertexProperty<ID,Double> weightedPagerank(PgxGraph graph, double e, double d, int max, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      PageRank on weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Weighted PageRank works like the original PageRank algorithm, except that it allows for a weight value assigned to each edge. This weight determines the fraction of the PageRank score that will flow from the source vertex through the current edge to its destination vertex.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It extends the scope of the PageRank applications by allowing edges with non-uniform weights, which can reflect better the structures underlying in graphs.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.weightedPagerank(graph, 0.001, 0.85, 100, false, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertices);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices, boolean norm) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertices, false);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertices, 0.001, 0.85, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertices, 0.001, 0.85, 100, false);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertices, 0.001, 0.85, 100, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedPagerank(graph, vertices, 0.001, 0.85, 100, false, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertices, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, VertexSet<ID> vertices, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized PageRank for a set of vertices of interest. It compares and spots out important vertices in a graph

      Definition

      The Personalized Pagerank allows to select a particular vertex or a set of vertices from the given graph in order to give them a greater importance when computing the ranking score, which will have as result a personalized Pagerank score and reveal relevant (or similar) vertices to the ones chosen at the beginning.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It introduces the concept of personalization for the PageRank applications, which allows to get relevant information from the given subset of vertices.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedPagerank(graph, vertices, false, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.personalizedWeightedPagerank(graph, vertex, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, boolean norm, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.personalizedWeightedPagerank(graph, vertex, false, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedWeightedPagerank(graph, vertex, 0.001, 0.85, 100, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank =
          analyst.personalizedWeightedPagerank(graph, vertex, 0.001, 0.85, 100, false, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedWeightedPagerank(graph, vertex, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedWeightedPagerank(graph, vertex, false, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank =
          analyst.personalizedWeightedPagerank(graph, vertex, 0.001, 0.85, 100, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, PgxVertex<ID> v, double e, double d, int max, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized weighted pagerank for a vertex and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      v - the chosen vertex from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) weighted PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedWeightedPagerank(graph, vertex, 0.001, 0.85, 100, false, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.personalizedWeightedPagerank(graph, vertices, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, boolean norm, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank = analyst.personalizedWeightedPagerank(graph, vertices, false, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedWeightedPagerank(graph, vertices, 0.001, 0.85, 100, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedWeightedPagerank(graph, vertices, 0.001, 0.85, 100, false, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank = analyst.personalizedWeightedPagerank(graph, vertices, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedWeightedPagerank(graph, vertices, false, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedWeightedPagerank(graph, vertices, 0.001, 0.85, 100, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, VertexSet<ID> vertices, double e, double d, int max, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      Personalized pagerank for a set of vertices and weighted edges. It compares and spots out important vertices in a graph

      Definition

      The Personalized Weighted Pagerank combines elements from the weighted and the personalized versions in order to make the personalization of the results more unique, since both: the selection of a subset of vertices and the inclusion of specific weights in the edges, will help to set the importance of the ranking scores when these are being computed.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The PageRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This variant takes the personalization of the ranking scores a step further, thus its use is suggested when looking for highly personalized results.
      Parameters:
      graph - the graph.
      vertices - the set of chosen vertices from the graph for personalization.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      weight - edge property holding the weight of each edge in the graph.
      rank - (out argument) vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) PageRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> pagerank =
         analyst.personalizedWeightedPagerank(graph, vertices, 0.001, 0.85, 100, false, cost, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + pagerank.getName() + " MATCH (x) ORDER BY x." + pagerank.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph, boolean norm) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph, false);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph, double e, double d, int max) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph, 0.001, 0.85, 100);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph, double e, double d, int max, boolean norm) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph, 0.001, 0.85, 100, false);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph, rank);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph, false, rank);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph, double e, double d, int max, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph, 0.001, 0.85, 100, rank);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • articleRank

      public <ID> VertexProperty<ID,Double> articleRank(PgxGraph graph, double e, double d, int max, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException

      ArticleRank computes ranking scores based on the edges in a graph. It compares and spots out important vertices in a graph

      Definition

      ArticleRank is a variant of the PageRank algorithm and operates in a similar way. It computes the ranking score for the vertices by analyzing the incoming edges, while reducing the assumption that relationships with nodes that have a low out-degree are of higher importance.

      Implementation Details

      The implementation of this algorithm uses an iterative method. The ArticleRank values of all the vertices in the graph are computed, hence updated, at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • ArticleRank can be used to measure the influence of articles and academic papers based on their citation analysis. The computed rank indicates how frequently an article is cited.
      Parameters:
      graph - the graph.
      e - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      d - damping factor.
      max - maximum number of iterations that will be performed.
      norm - boolean flag to determine whether the algorithm will take into account dangling vertices for the ranking scores.
      rank - (out argument) vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).
      Returns:
      vertex property holding the (normalized) ArticleRank value for each vertex (a value between 0 and 1).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> articlerank = analyst.articleRank(graph, 0.001, 0.85, 100, false, rank);
       PgqlResultSet query = graph.queryPgql(
         "SELECT x, x." + articlerank.getName() + " MATCH (x) ORDER BY x." + articlerank.getName() + " DESC");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • vertexBetweennessCentrality

      public <ID> VertexProperty<ID,Double> vertexBetweennessCentrality(PgxGraph graph) throws ExecutionException, InterruptedException

      Betweenness centrality measures the centrality of the vertices to identify important vertices for the flow of information

      Definition

      The Betweenness Centrality of a vertex V in a graph is the sum of the fraction of shortest paths that pass through V from all the possible shortest paths connecting every possible pair of vertices S, T in the graph, such that V is different from S and T. Because of its definition, the algorithm is meant for connected graphs.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> betweenness = analyst.vertexBetweennessCentrality(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • vertexBetweennessCentrality

      public <ID> VertexProperty<ID,Double> vertexBetweennessCentrality(PgxGraph graph, VertexProperty<ID,Double> bc) throws ExecutionException, InterruptedException

      Betweenness centrality measures the centrality of the vertices to identify important vertices for the flow of information

      Definition

      The Betweenness Centrality of a vertex V in a graph is the sum of the fraction of shortest paths that pass through V from all the possible shortest paths connecting every possible pair of vertices S, T in the graph, such that V is different from S and T. Because of its definition, the algorithm is meant for connected graphs.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      bc - (out argument) vertex property holding the betweenness centrality value for each vertex.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> bc = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> betweenness = analyst.vertexBetweennessCentrality(graph, bc);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • approximateVertexBetweennessCentrality

      public <ID> VertexProperty<ID,Double> approximateVertexBetweennessCentrality(PgxGraph graph, int k) throws ExecutionException, InterruptedException

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using k random vertices as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      k - number of random vertices to be used to compute the approximated betweenness centrality coefficients.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> betweenness = analyst.approximateVertexBetweennessCentrality(graph, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • approximateVertexBetweennessCentrality

      public <ID> VertexProperty<ID,Double> approximateVertexBetweennessCentrality(PgxGraph graph, int k, VertexProperty<ID,Double> bc) throws ExecutionException, InterruptedException

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using k random vertices as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      k - number of random vertices to be used to compute the approximated betweenness centrality coefficients.
      bc - (out argument) vertex property holding the betweenness centrality value for each vertex.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> bc = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> betweenness = analyst.approximateVertexBetweennessCentrality(graph, 100, bc);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • approximateVertexBetweennessCentralityFromSeeds

      @SafeVarargs public final <ID> VertexProperty<ID,Double> approximateVertexBetweennessCentralityFromSeeds(PgxGraph graph, PgxVertex<ID>... seeds) throws ExecutionException, InterruptedException

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using the vertices from the given sequence as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      seeds - the (unique) chosen nodes to be used to compute the approximated betweenness centrality coeficients.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> betweenness =
         analyst.approximateVertexBetweennessCentralityFromSeeds(graph, vertex);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • approximateVertexBetweennessCentralityFromSeeds

      @SafeVarargs public final <ID> VertexProperty<ID,Double> approximateVertexBetweennessCentralityFromSeeds(PgxGraph graph, VertexProperty<ID,Double> bc, PgxVertex<ID>... seeds) throws ExecutionException, InterruptedException

      Faster, but less accurate than betweenness centrality, it identifies important vertices for the flow of information

      Definition

      This variant of betweenness centrality approximates the centrality of the vertices by just using the vertices from the given sequence as starting points for the BFS traversals of the graph, instead of computing the exact value by using all the vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from betweenness centrality can be used to identify vertices in a graph that are vital for the flow of information within it, making it a good option for applications in social networks and problems modelling flows of any kind.
      Parameters:
      graph - the graph.
      bc - (out argument) vertex property holding the betweenness centrality value for each vertex.
      seeds - the (unique) chosen nodes to be used to compute the approximated betweenness centrality coeficients.
      Returns:
      vertex property holding the betweenness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> bc = graph.createVertexProperty(PropertyType.DOUBLE);
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> betweenness =
         analyst.approximateVertexBetweennessCentralityFromSeeds(graph, bc, vertex);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + betweenness.getName() + " MATCH (x) ORDER BY x." + betweenness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • closenessCentralityUnitLength

      public <ID> VertexProperty<ID,Double> closenessCentralityUnitLength(PgxGraph graph) throws ExecutionException, InterruptedException

      Closeness centrality measures the centrality of the vertices based on distances, allowing to find well-connected vertices

      Definition

      The Closeness Centrality of a node V is the reciprocal of the sum of all the distances from the possible shortest paths starting from V. Thus the higher the centrality value of V, the closer it is to all the other vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      Returns:
      node property holding the closeness centrality value for each node.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> closeness = analyst.closenessCentralityUnitLength(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • closenessCentralityUnitLength

      public <ID> VertexProperty<ID,Double> closenessCentralityUnitLength(PgxGraph graph, VertexProperty<ID,Double> cc) throws ExecutionException, InterruptedException

      Closeness centrality measures the centrality of the vertices based on distances, allowing to find well-connected vertices

      Definition

      The Closeness Centrality of a node V is the reciprocal of the sum of all the distances from the possible shortest paths starting from V. Thus the higher the centrality value of V, the closer it is to all the other vertices in the graph.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      cc - (out argument) node property holding the closeness centrality value for each node.
      Returns:
      node property holding the closeness centrality value for each node.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> cc = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> closeness = analyst.closenessCentralityUnitLength(graph, cc);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • closenessCentralityDoubleLength

      public <ID> VertexProperty<ID,Double> closenessCentralityDoubleLength(PgxGraph graph, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException

      Closeness centrality measures the centrality of the vertices based on weighted distances, allowing to find well-connected vertices

      Definition

      This variant of Closeness Centrality takes into account the weights from the edges when computing the reciprocal of the sum of all the distances from the possible shortest paths starting from the vertex V, for every vertex in the graph. The weights of the edges must be positive values greater than 0.

      Implementation Details

      The implementation of is more expensive to compute than the normal closeness centrality because of the inclusion of the weights in the edges which influence the selection of edges for the shortest paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E * d) with E = number of edges, V = number of vertices, d = diameter of the graph
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      cost - edge property holding the weight of each edge in the graph.
      Returns:
      vertex property holding the closeness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> closeness = analyst.closenessCentralityDoubleLength(graph, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • closenessCentralityDoubleLength

      public <ID> VertexProperty<ID,Double> closenessCentralityDoubleLength(PgxGraph graph, EdgeProperty<Double> cost, VertexProperty<ID,Double> cc) throws ExecutionException, InterruptedException

      Closeness centrality measures the centrality of the vertices based on weighted distances, allowing to find well-connected vertices

      Definition

      This variant of Closeness Centrality takes into account the weights from the edges when computing the reciprocal of the sum of all the distances from the possible shortest paths starting from the vertex V, for every vertex in the graph. The weights of the edges must be positive values greater than 0.

      Implementation Details

      The implementation of is more expensive to compute than the normal closeness centrality because of the inclusion of the weights in the edges which influence the selection of edges for the shortest paths. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E * d) with E = number of edges, V = number of vertices, d = diameter of the graph
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • The coefficient from closeness centrality can be used to identify vertices in a graph that are close and well connected to other vertices, hence it can be used in many applications for social networks when looking for vertices to spread information in a fast way.
      Parameters:
      graph - the graph.
      cost - edge property holding the weight of each edge in the graph.
      cc - (out argument) vertex property holding the closeness centrality value for each vertex.
      Returns:
      vertex property holding the closeness centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> cc = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> closeness = analyst.closenessCentralityDoubleLength(graph, cost, cc);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + closeness.getName() + " MATCH (x) ORDER BY x." + closeness.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • hits

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>> hits = analyst.hits(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + hits.getFirst().getName() + ", x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • hits

      public <ID> Pair<VertexProperty<ID,Double>,VertexProperty<ID,Double>> hits(PgxGraph graph, int max) throws ExecutionException, InterruptedException

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      max - number of iterations that will be performed.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>> hits = analyst.hits(graph, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + hits.getFirst().getName() + ", x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • hits

      public <ID> Pair<VertexProperty<ID,Double>,VertexProperty<ID,Double>> hits(PgxGraph graph, int max, VertexProperty<ID,Double> auth, VertexProperty<ID,Double> hubs) throws ExecutionException, InterruptedException

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      max - number of iterations that will be performed.
      auth - (out argument) vertex property holding the authority score for each vertex.
      hubs - (out argument) vertex property holding the hub score for each vertex.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> auth = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> hubs = graph.createVertexProperty(PropertyType.DOUBLE);
       Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>> hits = analyst.hits(graph, 100, auth, hubs);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + hits.getFirst().getName() + ", x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • hits

      HITS assigns ranking scores to the vertices, aimed to assess the quality of information and references in linked structures

      Definition

      HITS is an algorithm that computes two ranking scores (authority and hub)for each vertex in the graph. The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific topic, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. The authority score of a vertex V is computed by adding all the hub scores of its incoming neighbors (i.e. vertices with edges pointing to V). The hub score is computed in a similar way, using the authority scores instead.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Both, authority and hub scores, of all the vertices in the graph are computed and updated at each iteration step.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • HITS was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - the graph.
      auth - (out argument) vertex property holding the authority score for each vertex.
      hubs - (out argument) vertex property holding the hub score for each vertex.
      Returns:
      Pair holding the two vertex properties with the authority and hub scores.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> auth = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> hubs = graph.createVertexProperty(PropertyType.DOUBLE);
       Pair<VertexProperty<Integer, Double>, VertexProperty<Integer, Double>> hits = analyst.hits(graph, auth, hubs);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + hits.getFirst().getName() + ", x." + hits.getSecond().getName() + " MATCH (x) ORDER BY x." +
         hits.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • eigenvectorCentrality

      public <ID> VertexProperty<ID,Double> eigenvectorCentrality(PgxGraph graph) throws ExecutionException, InterruptedException

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> eigenvector = analyst.eigenvectorCentrality(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • eigenvectorCentrality

      public <ID> VertexProperty<ID,Double> eigenvectorCentrality(PgxGraph graph, int max, double maxDiff, boolean useL2Norm, boolean useInEdge) throws ExecutionException, InterruptedException

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      max - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      useL2Norm - boolean flag to determine whether the algorithm will use the l2 norm (Euclidean norm) or the l1 norm (absolute value) to normalize the centrality scores.
      useInEdge - boolean flag to determine whether the algorithm will use the incoming or the outgoing edges in the graph for the computations.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> eigenvector = analyst.eigenvectorCentrality(graph, 100, 0.001, false, false);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • eigenvectorCentrality

      public <ID> VertexProperty<ID,Double> eigenvectorCentrality(PgxGraph graph, int max, double maxDiff, boolean useL2Norm, boolean useInEdge, VertexProperty<ID,Double> ec) throws ExecutionException, InterruptedException

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      max - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      useL2Norm - boolean flag to determine whether the algorithm will use the l2 norm (Euclidean norm) or the l1 norm (absolute value) to normalize the centrality scores.
      useInEdge - boolean flag to determine whether the algorithm will use the incoming or the outgoing edges in the graph for the computations.
      ec - (out argument) vertex property holding the normalized centrality value for each vertex.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> ec = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> eigenvector = analyst.eigenvectorCentrality(graph, 100, 0.001, false, false, ec);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • eigenvectorCentrality

      public <ID> VertexProperty<ID,Double> eigenvectorCentrality(PgxGraph graph, VertexProperty<ID,Double> ec) throws ExecutionException, InterruptedException

      Eigenvector centrality gets the centrality of the vertices in an intricate way using neighbors, allowing to find well-connected vertices

      Definition

      The Eigenvector Centrality determines the centrality of a vertex by adding and weighting the centrality of its neighbors. Using outgoing or incoming edges when computing the eigenvector centrality will be equivalent to do so with the normal or the transpose adjacency matrix, respectively leading to the "right" and "left" eigenvectors.

      Implementation Details

      The implementation of this algorithm uses the power iteration method.

      Complexity

      • Time: O(V * k) with V = number of vertices, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100
      • max_diff: 0.001
      • use_l2norm: false
      • use_inEdges: false

      Applications

      • The eigenvector centrality assigns higher scores to vertices that are connected to other well-connected vertices in the graphs, making this algorithm a good option to find important or relevant people in social networks.
      Parameters:
      graph - the graph.
      ec - (out argument) vertex property holding the normalized centrality value for each vertex.
      Returns:
      vertex property holding the normalized centrality value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> ec = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> eigenvector = analyst.eigenvectorCentrality(graph, ec);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + eigenvector.getName() + " MATCH (x) ORDER BY x." + eigenvector.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • outDegreeCentrality

      public <ID> VertexProperty<ID,Integer> outDegreeCentrality(PgxGraph graph) throws ExecutionException, InterruptedException

      Out-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Out-Degree centrality returns the sum of the number of outgoing edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since out-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> degree = analyst.outDegreeCentrality(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • outDegreeCentrality

      public <ID> VertexProperty<ID,Integer> outDegreeCentrality(PgxGraph graph, VertexProperty<ID,Integer> dc) throws ExecutionException, InterruptedException

      Out-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Out-Degree centrality returns the sum of the number of outgoing edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since out-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      dc - (out argument) vertex property holding the degree centrality value for each vertex in the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> dc = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> degree = analyst.outDegreeCentrality(graph, dc);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • inDegreeCentrality

      public <ID> VertexProperty<ID,Integer> inDegreeCentrality(PgxGraph graph) throws ExecutionException, InterruptedException

      In-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      In-Degree centrality returns the sum of the number of incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since in-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> degree = analyst.inDegreeCentrality(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • inDegreeCentrality

      public <ID> VertexProperty<ID,Integer> inDegreeCentrality(PgxGraph graph, VertexProperty<ID,Integer> dc) throws ExecutionException, InterruptedException

      In-degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      In-Degree centrality returns the sum of the number of incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelism.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since in-degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      dc - (out argument) vertex property holding the degree centrality value for each vertex in the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> dc = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> degree = analyst.inDegreeCentrality(graph, dc);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • degreeCentrality

      public <ID> VertexProperty<ID,Integer> degreeCentrality(PgxGraph graph) throws ExecutionException, InterruptedException

      Degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Degree centrality counts the number of outgoing and incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> degree = analyst.degreeCentrality(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • degreeCentrality

      public <ID> VertexProperty<ID,Integer> degreeCentrality(PgxGraph graph, VertexProperty<ID,Integer> dc) throws ExecutionException, InterruptedException

      Degree centrality measures the centrality of the vertices based on its degree, letting you see how a vertex influences its neighborhood

      Definition

      Degree centrality counts the number of outgoing and incoming edges for each vertex in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since degree centrality accounts for the connections of the vertices, it can be used to see the influence a vertex has over the vertices in its immediate neighborhood.
      Parameters:
      graph - the graph.
      dc - (out argument) vertex property holding the degree centrality value for each vertex in the graph.
      Returns:
      vertex property holding the degree centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> dc = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> degree = analyst.degreeCentrality(graph, dc);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + degree.getName() + " MATCH (x) ORDER BY x." + degree.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • harmonicCentrality

      public <ID> VertexProperty<ID,Double> harmonicCentrality(PgxGraph graph, VertexProperty<ID,Double> hc) throws ExecutionException, InterruptedException

      Harmonic centrality measures node importance by considering the reciprocal of the sum of shortest path distances in the network.

      Definition

      Harmonic centrality computes the centrality of each vertex by taking the reciprocal of the sum of the shortest path distances from that vertex to all other vertices in the graph. This metric highlights the importance of vertices that efficiently connect disparate parts of the network

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Harmonic centrality can be applied in transportation networks to identify critical nodes that facilitate efficient travel between different destinations.
      Parameters:
      graph - the graph.
      hc - (out argument) vertex property holding the harmonic centrality value for each vertex in the graph.
      Returns:
      vertex property holding the harmonic centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Long, Double> hc = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Long, Double> harmonic = analyst.harmonicCentrality(graph, hc);
       PgqlResultSet query = graph.queryPgql("SELECT x, x." + harmonic.getName() + "FROM MATCH (x) ");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • harmonicCentrality

      public <ID> VertexProperty<ID,Double> harmonicCentrality(PgxGraph graph) throws ExecutionException, InterruptedException

      Harmonic centrality measures node importance by considering the reciprocal of the sum of shortest path distances in the network.

      Definition

      Harmonic centrality computes the centrality of each vertex by taking the reciprocal of the sum of the shortest path distances from that vertex to all other vertices in the graph. This metric highlights the importance of vertices that efficiently connect disparate parts of the network

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Harmonic centrality can be applied in transportation networks to identify critical nodes that facilitate efficient travel between different destinations.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the harmonic centrality value for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Long, Double> harmonic = analyst.harmonicCentrality(graph);
       PgqlResultSet query = graph.queryPgql("SELECT x, x." + harmonic.getName() + "FROM MATCH (x) ");
       query.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf = analyst.whomToFollow(graph, vertex);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex, int topK) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf = analyst.whomToFollow(graph, vertex, 100);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf = analyst.whomToFollow(graph, vertex, 100, 500);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex, VertexSequence<ID> hubs, VertexSequence<ID> authorities) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> auth = graph.createVertexSequence();
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf = analyst.whomToFollow(graph, vertex, hubs, auth);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex, int topK, VertexSequence<ID> hubs, VertexSequence<ID> authorities) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> auth = graph.createVertexSequence();
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf = analyst.whomToFollow(graph, vertex, 100, hubs, auth);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust, VertexSequence<ID> hubs, VertexSequence<ID> authorities) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> auth = graph.createVertexSequence();
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf =
         analyst.whomToFollow(graph, vertex, 100, 500, hubs, auth);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust, int maxIter, double tol, double dampingFactor, int salsaMaxIter, double salsaTol) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      maxIter - maximum number of iterations that will be performed for the Pagerank stage.
      tol - maximum tolerated error value for the Pagerank stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      dampingFactor - damping factor for the Pagerank stage.
      salsaMaxIter - maximum number of iterations that will be performed for the SALSA stage.
      salsaTol - maximum tolerated error value for the SALSA stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf =
         analyst.whomToFollow(graph, vertex, 100, 500, 100, 0.001, 0.85, 100, 0.001);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, PgxVertex<ID> vertex, int topK, int sizeCircleOfTrust, int maxIter, double tol, double dampingFactor, int salsaMaxIter, double salsaTol, VertexSequence<ID> hubs, VertexSequence<ID> authorities) throws ExecutionException, InterruptedException

      WTF is a recommendation algorithm. It returns two vertex sequences: one of similar users and a second one with users to follow.

      Definition

      The Whom To Follow algorithm is composed by two main stages: the first one is meant to get the relevant vertices (users) for a given source vertex (particular user), which in this implementation is done with personalized Pagerank for the given source vertex. While the second stage analyzes the relationships between the relevant vertices previously found through the edges linking them with their neighbors. This second stage relies on SALSA algorithm and it assigns a ranking score to all the hubs and authority vertices, so the recommendations can come from this assigned values. Whom To Follow takes the concept of authority and hub vertices, and adapts it to users in social networks. The hub vertices become similar users with respect to the given source vertex (also an user), and the authority vertices are translated into users that might be on the interest of the source vertex, i.e. users to follow.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * (p + s)) with E = number of edges, p <= maximum number of iterations for the Pagerank step, s <= maximum number of iterations for the SALSA step
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • WTF was designed to find and recommend similar users (hub vertices) and potential users to follow (authority vertices) in social networks with directed edges in their structures.
      Parameters:
      graph - the graph.
      vertex - the chosen vertex from the graph for personalization of the recommendations.
      topK - the maximum number of recommendations that will be returned. This number should be smaller than the size of the circle of trust.
      sizeCircleOfTrust - the maximum size of the circle of trust.
      maxIter - maximum number of iterations that will be performed for the Pagerank stage.
      tol - maximum tolerated error value for the Pagerank stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      dampingFactor - damping factor for the Pagerank stage.
      salsaMaxIter - maximum number of iterations that will be performed for the SALSA stage.
      salsaTol - maximum tolerated error value for the SALSA stage. The stage will stop once the sum of the error values of all vertices becomes smaller than this value.
      hubs - (out argument) vertex sequence holding the top rated hub vertices (similar users) for the recommendations.
      authorities - (out argument) vertex sequence holding the top rated authority vertices (users to follow) for the recommendations.
      Returns:
      Pair holding the node sequences with the hub and authority recommendations.

      Examples

       
       PgxGraph graph = ...;
       VertexSequence<Integer> hubs = graph.createVertexSequence();
       VertexSequence<Integer> auth = graph.createVertexSequence();
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexSequence<Integer>, VertexSequence<Integer>> wtf =
         analyst.whomToFollow(graph, vertex, 100, 500, 100, 0.001, 0.85, 100, 0.001, hubs, auth);
       wtf.getFirst();
       wtf.getSecond();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • salsa

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> salsa = analyst.salsa(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • salsa

      public <ID> VertexProperty<ID,Double> salsa(BipartiteGraph graph, double maxDiff, int maxIter) throws ExecutionException, InterruptedException

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> salsa = analyst.salsa(graph, 0.001, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • salsa

      public <ID> VertexProperty<ID,Double> salsa(BipartiteGraph graph, double maxDiff, int maxIter, VertexProperty<ID,Double> salsaRank) throws ExecutionException, InterruptedException

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> salsa = analyst.salsa(graph, 0.001, 100, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • salsa

      public <ID> VertexProperty<ID,Double> salsa(BipartiteGraph graph, VertexProperty<ID,Double> salsaRank) throws ExecutionException, InterruptedException

      SALSA computes ranking scores. It assesses the quality of information and references in linked structures

      Definition

      The idea of hubs and authorities comes from the web pages: a hub is regarded as a page that is not authoritative in a specific matter, but it has instead links to authority pages, which are regarded as meaningful sources for a particular topic by many hubs. Thus a good hub will point to many authorities, while a good authority will be pointed by many hubs. SALSA is an algorithm that computes authorities and hubs ranking scores for the vertices using the network created by the edges of the [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph and assigning weights to the contributions of their 2nd-degree neighbors. This way of computing the scores creates the independence between the authority and hub scores, which are assigned to the vertices depending on the side of the graph they belong (left:hub / right:aut).

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> salsa = analyst.salsa(graph, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, PgxVertex<ID> v) throws ExecutionException, InterruptedException

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertex);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, PgxVertex<ID> v, double d, int maxIter, double maxDiff) throws ExecutionException, InterruptedException

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertex, 0.85, 100, 0.001);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, PgxVertex<ID> v, VertexProperty<ID,Double> salsaRank) throws ExecutionException, InterruptedException

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertex, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, PgxVertex<ID> v, double d, int maxIter, double maxDiff, VertexProperty<ID,Double> salsaRank) throws ExecutionException, InterruptedException

      Personalized salsa for a vertex of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      v - the chosen vertex from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertex, 0.85, 100, 0.001, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, VertexSet<ID> vertices) throws ExecutionException, InterruptedException

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertices);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, VertexSet<ID> vertices, VertexProperty<ID,Double> salsaRank) throws ExecutionException, InterruptedException

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertices, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, VertexSet<ID> vertices, double d, int maxIter, double maxDiff) throws ExecutionException, InterruptedException

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertices, 0.85, 100, 0.001);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, VertexSet<ID> vertices, double d, int maxIter, double maxDiff, VertexProperty<ID,Double> salsaRank) throws ExecutionException, InterruptedException

      Personalized salsa for a set of vertices of interest. It assesses the quality of information and references in linked structures

      Definition

      This Personalized version of SALSA allows to select a particular vertex or set of vertices from the given graph in order to give them a greater importance when computing the ranking scores, which will have as result a personalized SALSA score and show relevant (or similar) vertices to the ones chosen for the personalization.

      Implementation Details

      The implementation of this algorithm uses an iterative method. It will converge once it reaches the error tolerance criteria or the maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • SALSA was designed to rate web pages given the links existing between them. It uses the authority of a page (vertex) to asses the quality of the information it has, while the hub score do so for the quality of the links to other pages (vertices).
      Parameters:
      graph - Bipartite graph.
      vertices - the set of chosen vertices from the graph for personalization.
      d - damping factor to modulate the degree of personalization of the scores by the algorithm.
      maxIter - maximum number of iterations that will be performed.
      maxDiff - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      salsaRank - (out argument) vertex property holding the normalized authority/hub ranking score for each vertex.
      Returns:
      vertex property holding the normalized authority/hub ranking score for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.getVertices(VertexFilter.fromExpression("vertex.prop1 < 10"));
       VertexProperty<Integer, Double> rank = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> salsa = analyst.personalizedSalsa(graph, vertices, 0.85, 100, 0.001, rank);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + salsa.getName() + " MATCH (x) ORDER BY x." + salsa.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesConductanceMinimization

      public <ID> Partition<ID> communitiesConductanceMinimization(PgxGraph graph) throws ExecutionException, InterruptedException

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> conductance = analyst.communitiesConductanceMinimization(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesConductanceMinimization

      public <ID> Partition<ID> communitiesConductanceMinimization(PgxGraph graph, int maxIterations) throws ExecutionException, InterruptedException

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      maxIterations - maximum number of iterations that will be performed. For most graphs, a maximum of 100 iterations should be enough.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> conductance = analyst.communitiesConductanceMinimization(graph, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesConductanceMinimization

      public <ID> Partition<ID> communitiesConductanceMinimization(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution) throws ExecutionException, InterruptedException

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> conductance = analyst.communitiesConductanceMinimization(graph, pd);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesConductanceMinimization

      public <ID> Partition<ID> communitiesConductanceMinimization(PgxGraph graph, int maxIterations, VertexProperty<ID,Long> partitionDistribution) throws ExecutionException, InterruptedException

      Soman and Narang can find communities in a graph taking weighted edges into account

      Definition

      The algorithm proposed by Soman and Narang to find community structures in a graph can be regarded as a variant of the label propagation algorithm, since it takes into account weights over the edges when looking for the community assignments. This implementation generates the weight of the edges by using the triangles in the graph, and just like label propagation, it assigns a unique community label to each vertex in the graph at the beginning, which is then updated on each iteration by looking and choosing the most frequent label from the labels of their neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. Also note that there is a possibility of constant vertex swapping. For example, if you have two vertices A and B in your graph. It can happen that A will acquire the community of B but at the same time B will acquire the community of A. That is why you should set a maximum number of iterations.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(5 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      maxIterations - maximum number of iterations that will be performed. For most graphs, a maximum of 100 iterations should be enough.
      partitionDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> conductance = analyst.communitiesConductanceMinimization(graph, 100, pd);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesLabelPropagation

      public <ID> Partition<ID> communitiesLabelPropagation(PgxGraph graph) throws ExecutionException, InterruptedException

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> conductance = analyst.communitiesLabelPropagation(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesLabelPropagation

      public <ID> Partition<ID> communitiesLabelPropagation(PgxGraph graph, int maxIterations) throws ExecutionException, InterruptedException

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      maxIterations - maximum number of iterations that will be performed.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> conductance = analyst.communitiesLabelPropagation(graph, 100);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesLabelPropagation

      public <ID> Partition<ID> communitiesLabelPropagation(PgxGraph graph, int maxIterations, VertexProperty<ID,Long> partitionDistribution) throws ExecutionException, InterruptedException

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      maxIterations - maximum number of iterations that will be performed.
      partitionDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> conductance = analyst.communitiesLabelPropagation(graph, 100, pd);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesLabelPropagation

      public <ID> Partition<ID> communitiesLabelPropagation(PgxGraph graph, VertexProperty<ID,Long> partitonDistribution) throws ExecutionException, InterruptedException

      Label propagation can find communities in a graph relatively fast

      Definition

      Label Propagation is an algorithm designed to find community structures in a graph. It assigns a unique community label to each vertex in the graph, which then is updated on each iteration by looking and choosing the most frequent label amongst those from its neighbors. Convergence is achieved once the label of each vertex is the same as the most frequent one amongst its neighbors, i.e. when there are no changes in the communities assigned to the vertices in one iteration.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(2 * V) with V = number of vertices

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the graph.
      partitonDistribution - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> conductance = analyst.communitiesLabelPropagation(graph, pd);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + conductance.getPropertyName() + " MATCH (x) ORDER BY x." + conductance.getPropertyName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesInfomap

      public <ID> Partition<ID> communitiesInfomap(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> promise = analyst.communitiesInfomap(graph, rank, weight);
       first_component = promise.getPartitionByIndex(0)
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesInfomap

      public <ID> Partition<ID> communitiesInfomap(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight, double tau, double tol, int maxIter) throws ExecutionException, InterruptedException

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      tau - damping factor.
      tol - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> promise = analyst.communitiesInfomap(graph, rank, weight, 0.15, 0.0001, 10);
       first_component = promise.getPartitionByIndex(0)
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesInfomap

      public <ID> Partition<ID> communitiesInfomap(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight, VertexProperty<ID,Long> module) throws ExecutionException, InterruptedException

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      module - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> promise = analyst.communitiesInfomap(graph, rank, weight, module);
       first_component = promise.getPartitionByIndex(0)
       
       
      Throws:
      ExecutionException
      InterruptedException
    • communitiesInfomap

      public <ID> Partition<ID> communitiesInfomap(PgxGraph graph, VertexProperty<ID,Double> rank, EdgeProperty<Double> weight, double tau, double tol, int maxIter, VertexProperty<ID,Long> module) throws ExecutionException, InterruptedException

      Infomap can find high quality communities in a graph.

      Definition

      Infomap is a robust algorithm designed to find community structures in a graph that requires some pre-processing steps. This implementation needs a reciprocated or an undirected graph, as well as the ranking score from the normalized weighted version of the Pagerank algorithm. It will assign a unique module (or community) label to each vertex in the graph based on their Pagerank score, edge weights and the labels of their neighbors. It is an iterative algorithm that updates the labels of the vertices in random order on each iteration using the previous factors, converging once there are no further changes in the vertex labels, or once the maximum number of iterations is reached. The algorithm is non-deterministic because of the random order for visiting and updating the vertex labels, thus the communities found might be different each time the algorithm is run.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O((k ^ 2) * E) with E = number of edges, k <= maximum number of iterations
      • Space: O(10 * V + 2 * E) with V = number of vertices, E = number of edges

      Default Values

      • max_iter: 100

      Applications

      • Community detection can be used for clustering and can be applied to the analysis of organization in real-world scenarios like groups of people in social networks.
      Parameters:
      graph - the undirected graph.
      rank - vertex property holding the normalized (weighted) PageRank value for each vertex (a value between 0 and 1).
      weight - edge property holding the weight of each edge in the graph.
      tau - damping factor.
      tol - maximum tolerated error value. The algorithm will stop once the sum of the error values of all vertices becomes smaller than this value.
      maxIter - maximum number of iterations that will be performed.
      module - vertex property holding the label of the community assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the communities found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> rank = analyst.weightedPagerank(graph, 1e-16, 0.85, 1000, true, weight);
       VertexProperty<Integer, Long> module = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> promise = analyst.communitiesInfomap(graph, rank, weight, 0.15, 0.0001, 10, module);
       first_component = promise.getPartitionByIndex(0)
       
       
      Throws:
      ExecutionException
      InterruptedException
    • louvain

      public <ID> VertexProperty<ID,Long> louvain(PgxGraph graph, EdgeProperty<Double> weight, int maxIter, int nbrPass, double tol, VertexProperty<ID,Long> community) throws ExecutionException, InterruptedException

      Louvain can detect communities in a large graph relatively fast.

      Definition

      Louvain is an algorithm for community detection in large graphs which uses the graph's modularity. Initially it assigns a different community to each node of the graph. It then iterates over the nodes and evaluates for each node the modularity gain obtained by removing the node from its community and placing it in the community of one of its neighbors. The node is placed in the community for which the modularity gain is maximum. This process is repeated for all nodes until no improvement is possible, i.e until no new assignment of a node to a different community can improve the graph's modularity.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(8 * V + E) with V = number of vertices

      Default Values

      Applications

      • The Louvain algorithm can be used for community detection in a multiple real-life situations, like identifying cyber-communities in a social network.
      Parameters:
      graph - the graph.
      weight - weights of the edges of the graph.
      maxIter - maximum number of iterations that will be performed during each pass.
      nbrPass - number of passes that will be performed.
      tol - maximum tolerated error value. The algorithm will stop once the graph's total modularity gain becomes smaller than this value.
      community - the community ID assigned to each node.
      Returns:
      the community ID assigned to each node.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Long, Long> community = graph.createVertexProperty(PropertyType.LONG,"COMMUNITY");
       var result = analyst.louvain(graph, weight, 100, 10, 0.001, community);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • louvain

      public <ID> VertexProperty<ID,Long> louvain(PgxGraph graph, EdgeProperty<Double> weight, int maxIter) throws ExecutionException, InterruptedException

      Louvain can detect communities in a large graph relatively fast.

      Definition

      Louvain is an algorithm for community detection in large graphs which uses the graph's modularity. Initially it assigns a different community to each node of the graph. It then iterates over the nodes and evaluates for each node the modularity gain obtained by removing the node from its community and placing it in the community of one of its neighbors. The node is placed in the community for which the modularity gain is maximum. This process is repeated for all nodes until no improvement is possible, i.e until no new assignment of a node to a different community can improve the graph's modularity.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(8 * V + E) with V = number of vertices

      Default Values

      Applications

      • The Louvain algorithm can be used for community detection in a multiple real-life situations, like identifying cyber-communities in a social network.
      Parameters:
      graph - the graph.
      weight - weights of the edges of the graph.
      maxIter - maximum number of iterations that will be performed during each pass.
      Returns:
      the community ID assigned to each node.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Long, Long> community = analyst.louvain(graph, weight, 100);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • louvain

      public <ID> VertexProperty<ID,Long> louvain(PgxGraph graph, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Louvain can detect communities in a large graph relatively fast.

      Definition

      Louvain is an algorithm for community detection in large graphs which uses the graph's modularity. Initially it assigns a different community to each node of the graph. It then iterates over the nodes and evaluates for each node the modularity gain obtained by removing the node from its community and placing it in the community of one of its neighbors. The node is placed in the community for which the modularity gain is maximum. This process is repeated for all nodes until no improvement is possible, i.e until no new assignment of a node to a different community can improve the graph's modularity.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(8 * V + E) with V = number of vertices

      Default Values

      Applications

      • The Louvain algorithm can be used for community detection in a multiple real-life situations, like identifying cyber-communities in a social network.
      Parameters:
      graph - the graph.
      weight - weights of the edges of the graph.
      Returns:
      the community ID assigned to each node.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("cost");
       VertexProperty<Long, Long> community = analyst.louvain(graph, weight);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • speakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> speakerListenerLabelPropagation(PgxGraph graph, String labelsPropName) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      Returns:
      distinct vertex labels which meet the threshold parameter.

      Examples

       
       PgxGraph graph = ...;
       String labelsPropName = "...";
       VertexProperty<ID, String> labels = analyst.speakerListenerLabelPropagation(graph, labelsPropName);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • speakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> speakerListenerLabelPropagation(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      Returns:
      distinct vertex labels which meet the threshold parameter.

      Examples

       
       PgxGraph graph = ...;
       String labelsPropName = "...";
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.speakerListenerLabelPropagation(graph, labelsPropName, maxIter,
        threshold, delimiter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • speakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> speakerListenerLabelPropagation(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labels - distinct vertex labels which meet the threshold parameter.
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      Returns:
      distinct vertex labels which meet the threshold parameter.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.speakerListenerLabelPropagation(graph, labels, maxIter,
        threshold, delimiter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> weightedSpeakerListenerLabelPropagation(PgxGraph graph, String labelsPropName, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant uses the edges weight to find those communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      weight - edge property holding the weight of each edge in the graph.
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       String labelsPropName = "...";
       VertexProperty<ID, String> labels = analyst.speakerListenerLabelPropagation(graph, labelsPropName, weight);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> weightedSpeakerListenerLabelPropagation(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant uses the edges weight to find those communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labelsPropName - The name of the string property.
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      weight - edge property holding the weight of each edge in the graph.
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       String labelsPropName = "...";
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.weightedSpeakerListenerLabelPropagation(graph, labelsPropName, maxIter,
        threshold, delimiter, weight);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • weightedSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> weightedSpeakerListenerLabelPropagation(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant uses the edges weight to find those communities.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph - the graph.
      labels -
      maxIter - number of iterations.
      threshold - minimum frequency for a label to retain a vertex.
      delimiter - string delimiter for labels.
      weight - edge property holding the weight of each edge in the graph.
      Returns:

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.weightedSpeakerListenerLabelPropagation(graph, labels, maxIter,
        threshold, delimiter, weight);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • filteredSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> filteredSpeakerListenerLabelPropagation(PgxGraph graph, String labelsPropName, EdgeFilter filter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       String labelsPropName = "...";
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       VertexProperty<ID, String> labels = analyst.filteredSpeakerListenerLabelPropagation(graph, labelsPropName,
        filter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • filteredSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> filteredSpeakerListenerLabelPropagation(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter, EdgeFilter filter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      maxIter -
      threshold -
      delimiter -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       String labelsPropName = "...";
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.filteredSpeakerListenerLabelPropagation(graph, labelsPropName, maxIter,
        threshold, delimiter, filter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • filteredSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> filteredSpeakerListenerLabelPropagation(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter, EdgeFilter filter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labels -
      maxIter -
      threshold -
      delimiter -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.filteredSpeakerListenerLabelPropagation(graph, labels, maxIter,
        threshold, delimiter, filter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • filteredWeightedSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> filteredWeightedSpeakerListenerLabelPropagation(PgxGraph graph, String labelsPropName, EdgeProperty<Double> weight, EdgeFilter filter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to and uses the edges' weight to update the frequency of listened labels.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      weight -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       String labelsPropName = "...";
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       VertexProperty<ID, String> labels = analyst.filteredWeightedSpeakerListenerLabelPropagation(graph, labelsPropName,
        weight, filter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • filteredWeightedSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> filteredWeightedSpeakerListenerLabelPropagation(PgxGraph graph, String labelsPropName, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight, EdgeFilter filter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to and uses the edges' weight to update the frequency of listened labels.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labelsPropName - The name of the string property.
      maxIter -
      threshold -
      delimiter -
      weight -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       String labelsPropName = "...";
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.filteredWeightedSpeakerListenerLabelPropagation(graph,
        labelsPropName, maxIter, threshold, delimiter, weight, filter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • filteredWeightedSpeakerListenerLabelPropagation

      public <ID> VertexProperty<ID,String> filteredWeightedSpeakerListenerLabelPropagation(PgxGraph graph, VertexProperty<ID,String> labels, int maxIter, double threshold, String delimiter, EdgeProperty<Double> weight, EdgeFilter filter) throws ExecutionException, InterruptedException

      Speaker listener label propagation can find overlaping and multiple communities in a graph relatively fast.

      Definition

      The speaker listener label propagation algorithm is an extension of the label propagation algorithm, which is able to detect overlapping communities. This variant utilizes an edge filter to select which neighbors to listen to and uses the edges' weight to update the frequency of listened labels.

      Implementation Details

      null

      Complexity

      • Time: O(max_iter * N) with N = number of neighbors of vertex1, max_iter = number of iterations
      • Space: O(N + V * max_iter) with N = number of neighbors of vertex1, max_iter = number of iterations

      Default Values

      • max_iter: 100
      • threshold: 0.0
      • delimiter: |

      Applications

      Parameters:
      graph -
      labels -
      maxIter -
      threshold -
      delimiter -
      weight -
      filter -
      Returns:

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<ID, String> labels = graph.createVertexProperty(PropertyType.STRING);
       EdgeProperty<Double> weight = graph.getEdgeProperty("weight");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.weight > 2.7");
       int maxIter = 100;
       double threshold = 0.2;
       String delimiter = "|";
       VertexProperty<ID, String> labels = analyst.filteredWeightedSpeakerListenerLabelPropagation(graph, labels,
        maxIter, threshold, delimiter, weight, filter);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • countTriangles

      public long countTriangles(PgxGraph graph, boolean sortVerticesByDegree) throws ExecutionException, InterruptedException

      triangle counting gives an overview of the amount of connections between vertices in neighborhoods

      Definition

      This algorithm is intended for directed graphs and will count all the existing triangles on it. To run the algorithm on undirected graphs, use the undirected version.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E ^ 1.5) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Triangles in graphs can be used as a measure of the quality in social networks, they can help to find communities within graphs.
      Parameters:
      graph - the graph.
      sortVerticesByDegree - boolean flag for sorting the nodes by their degree as preprocessing step.
      Returns:
      returns the total number of triangles found.

      Examples

       
       PgxGraph graph = ...;
       long result = analyst.countTriangles(graph, true);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • adamicAdarCounting

      public <V> EdgeProperty<Double> adamicAdarCounting(PgxGraph graph) throws ExecutionException, InterruptedException

      The adamic-adar index compares the amount of neighbors shared between vertices, this measure can be used with communities.

      Definition

      The Adamic-Adar index is meant for undirected graphs, since it is computed using the degree of the shared neighbors by two vertices in the graph. This implementation is intended for undirected graphs and computes the index for every pair of vertices connected by an edge and associates it with that edge.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(E) with E = number of edges

      Default Values

      Applications

      • The Adamic-Adar index can be used to find correlations between groups of people in social networks, thus characterize communities and also infer potential new links between them.
      Parameters:
      graph - the graph.
      Returns:
      edge property holding the Adamic-Adar index of each edge in the graph.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> adamicAdar = analyst.adamicAdarCounting(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + adamicAdar.getName() + " MATCH (x) ORDER BY x." + adamicAdar.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • adamicAdarCounting

      public <V> EdgeProperty<Double> adamicAdarCounting(PgxGraph graph, EdgeProperty<Double> aa) throws ExecutionException, InterruptedException

      The adamic-adar index compares the amount of neighbors shared between vertices, this measure can be used with communities.

      Definition

      The Adamic-Adar index is meant for undirected graphs, since it is computed using the degree of the shared neighbors by two vertices in the graph. This implementation is intended for undirected graphs and computes the index for every pair of vertices connected by an edge and associates it with that edge.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(E) with E = number of edges

      Default Values

      Applications

      • The Adamic-Adar index can be used to find correlations between groups of people in social networks, thus characterize communities and also infer potential new links between them.
      Parameters:
      graph - the graph.
      aa - (out argument) edge property holding the Adamic-Adar index of each edge in the graph.
      Returns:
      edge property holding the Adamic-Adar index of each edge in the graph.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> aa = graph.createEdgeProperty(PropertyType.DOUBLE);
       EdgeProperty<Double> adamicAdar = analyst.adamicAdarCounting(graph, aa);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + adamicAdar.getName() + " MATCH (x) ORDER BY x." + adamicAdar.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • randomWalkWithRestart

      public <ID> PgxMap<PgxVertex<ID>,Integer> randomWalkWithRestart(PgxGraph graph, PgxVertex<ID> source, int length, double resetProb, PgxMap<PgxVertex<ID>,Integer> visitCount) throws ExecutionException, InterruptedException

      random walk with restart does the what its name says, it can find approximate stationary distributions

      Definition

      This algorithm performs a random walk over the graph. The walk will start at the given source vertex and will randomly visit neighboring vertices in the graph, with a probability equal to the value of reset_probability of going back to the starting point. The random walk will also go back to the starting point every time it reaches a vertex with no outgoing edges. The algorithm will stop once it reaches the specified walk length.

      Implementation Details

      The implementation of this algorithm uses an iterative method. Since the algorithm visits the vertices in a random order on each iteration it is non-deterministic.

      Complexity

      • Time: O(L) with L = length of the random walk
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • The information gathered from a random walk can be used to approximate stationary distributions when the number of visits is normalized
      Parameters:
      graph - the graph.
      source - (in argument) starting point of the random walk.
      length - (in argument) length (number of steps) of the random walk.
      resetProb - (in argument) probability value for resetting the random walk.
      visitCount - (out argument) map holding the number of visits during the random walk for each vertex in the graph.
      Returns:
      map holding the number of visits during the random walk for each vertex in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<PgxVertex, Integer> visitCount = graph.createMap(PropertyType.VERTEX, PropertyType.INTEGER);
       PgxMap<PgxVertex, Integer> count = analyst.randomWalkWithRestart(graph, 0, 100, 0,6, visit_count);
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • bipartiteCheck

      public <ID> VertexProperty<ID,Boolean> bipartiteCheck(PgxGraph graph, VertexProperty<ID,Boolean> isLeft) throws ExecutionException, InterruptedException

      Bipartite check verifies whether are graph is a bipartite graph.

      Definition

      This algorithm checks whether the given directed graph is bipartite. It assumes that all the edges are going in the same direction since the method relies on BFS traversals of the graph. If the graph is bipartite the algorithm will return the side of each vertex in the graph with the is_left vertex property.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS method for the graph traversals.

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • Checking whether a graph is a bipartite one is important since some other graph algorithms rely on this particular condition.
      Parameters:
      graph - the graph.
      isLeft - vertex property holding the side of each vertex in a bipartite graph (true for left, false for right).
      Returns:
      vertex property holding the side of each vertex in a bipartite graph (true for left, false for right).

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Boolean> isLeft = graph.createVertexProperty(PropertyType.BOOLEAN);
       VertexProperty<Integer, Boolean> bipartite = analyst.BipartiteCheck(graph, isLeft);
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • conductance

      public <ID> Scalar<Double> conductance(PgxGraph graph, Partition<ID> partition, long partitionIndex) throws ExecutionException, InterruptedException

      Conductance assesses the quality of a partition in a graph

      Definition

      Conductance in a graph is computed for a specific cut of it. A cut is a partition of the graph into two subsets (components), disconnecting the graph if the edges from the cut are removed. Thus the algorithm requires a labeling for the vertices in the different subsets of the graph, then the conductance is computed by the ratio of the edges belonging to the given cut (i.e. the edges that split the graph into disconnected components) and the edges belonging to each of these subsets. If there is more than one cut (or partition), this implementation will take the given component number as reference to compute the conductance associated with that particular cut.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(1)

      Default Values

      • num: 0

      Applications

      • Conductance can be used to measure how well connected a graph is, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      partitionIndex - number of the component to be used for computing its conductance.
      Returns:
      Scalar (double) to store the conductance value of the given cut.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Scalar<Double> conductance = analyst.conductance(graph, partition, 0);
       conductance.get();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • conductance

      public <ID> Scalar<Double> conductance(PgxGraph graph, Partition<ID> partition, long partitionIndex, Scalar<Double> conductance) throws ExecutionException, InterruptedException

      Conductance assesses the quality of a partition in a graph

      Definition

      Conductance in a graph is computed for a specific cut of it. A cut is a partition of the graph into two subsets (components), disconnecting the graph if the edges from the cut are removed. Thus the algorithm requires a labeling for the vertices in the different subsets of the graph, then the conductance is computed by the ratio of the edges belonging to the given cut (i.e. the edges that split the graph into disconnected components) and the edges belonging to each of these subsets. If there is more than one cut (or partition), this implementation will take the given component number as reference to compute the conductance associated with that particular cut.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(1)

      Default Values

      • num: 0

      Applications

      • Conductance can be used to measure how well connected a graph is, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      partitionIndex - number of the component to be used for computing its conductance.
      conductance - Scalar (double) to store the conductance value of the given cut.
      Returns:
      Scalar (double) to store the conductance value of the given cut.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Scalar<Double> scalar = graph.createScalar(PropertyType.DOUBLE);
       Scalar<Double> conductance = analyst.conductance(graph, partition, 0, scalar);
       conductance.get();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • partitionModularity

      public <ID> Scalar<Double> partitionModularity(PgxGraph graph, Partition<ID> partition) throws ExecutionException, InterruptedException

      Modularity summarizes information about the quality of components in a graph

      Definition

      Modularity in a graph is a measure for assessing the quality of the partition induced by the components (or community structures) within the graph found by any clustering algorithm (e.g. label propagation, Infomap, WCC, etc.). It compares the number of the edges between the vertices within a component against the expected number of edges if these were generated at random (assuming a uniform probability distribution). A positive modularity value means that, on average, there are more edges within the components than the amount expected (meaning stronger components), and vice-versa for a negative modularity value. This implementation is intended for directed graphs.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E * c) with E = number of edges, c = number of components
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since modularity help to assess the quality of communities in a graph, it can be used in optimization processes when detecting them in other algorithms.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      Returns:
      Scalar (double) with the modularity value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Scalar<Double> modularity = analyst.partitionModularity(graph, partition);
       modularity.get();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • partitionModularity

      public <ID> Scalar<Double> partitionModularity(PgxGraph graph, Partition<ID> partition, Scalar<Double> modularity) throws ExecutionException, InterruptedException

      Modularity summarizes information about the quality of components in a graph

      Definition

      Modularity in a graph is a measure for assessing the quality of the partition induced by the components (or community structures) within the graph found by any clustering algorithm (e.g. label propagation, Infomap, WCC, etc.). It compares the number of the edges between the vertices within a component against the expected number of edges if these were generated at random (assuming a uniform probability distribution). A positive modularity value means that, on average, there are more edges within the components than the amount expected (meaning stronger components), and vice-versa for a negative modularity value. This implementation is intended for directed graphs.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E * c) with E = number of edges, c = number of components
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Since modularity help to assess the quality of communities in a graph, it can be used in optimization processes when detecting them in other algorithms.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      modularity - Scalar (double) to store the modularity value.
      Returns:
      Scalar (double) with the modularity value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Scalar<Double> scalar = graph.createScalar(PropertyType.DOUBLE);
       Scalar<Double> modularity = analyst.partitionModularity(graph, partition, scalar);
       modularity.get();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • partitionConductance

      public <ID> Pair<Scalar<Double>,Scalar<Double>> partitionConductance(PgxGraph graph, Partition<ID> partition) throws ExecutionException, InterruptedException

      Partition conductance assesses the quality of many partitions in a graph

      Definition

      This variant of the conductance algorithm will compute the conductance for the given number of components, returning an output with the minimum value of conductance found from the corresponding partitions and their average conductance value.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(1)

      Default Values

      Applications

      • Conductance can be used to measure how well connected is a graph, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      Returns:
      Pair with two scalars, the first one with the value of the average conductance, and the second with minimun conductance value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Pair<Scalar<Double>, Scalar<Double>> conductance = analyst.partitionConductance(graph, partition);
       conductance.getFirst().get();
       conductance.getSecond().get();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • partitionConductance

      public <ID> Pair<Scalar<Double>,Scalar<Double>> partitionConductance(PgxGraph graph, Partition<ID> partition, Scalar<Double> avgConductance, Scalar<Double> minConductance) throws ExecutionException, InterruptedException

      Partition conductance assesses the quality of many partitions in a graph

      Definition

      This variant of the conductance algorithm will compute the conductance for the given number of components, returning an output with the minimum value of conductance found from the corresponding partitions and their average conductance value.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization. Note that this algorithm will be inefficient if number_of_components are big (i.e. O(N)).

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(1)

      Default Values

      Applications

      • Conductance can be used to measure how well connected is a graph, making it an useful auxiliary measure to assess the quality of clusters in a graph, since these could be regarded as the subsets of a cut.
      Parameters:
      graph - the graph.
      partition - Partition of the graph with the corresponding node collections.
      avgConductance - Scalar that will get updated with the computed average conductance value.
      minConductance - Scalar that will get updated with the computed minimum conductance value.
      Returns:
      Pair with two scalars, the first one with the value of the average conductance, and the second with minimun conductance value.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> partition = analyst.communitiesConductanceMinimization(graph);
       Scalar<Double> avgConductance = graph.createScalar(PropertyType.DOUBLE);
       Scalar<Double> minConductance = graph.createScalar(PropertyType.DOUBLE);
       Pair<Scalar<Double>, Scalar<Double>> conductance =
         analyst.partitionConductance(graph, partition, avgConductance, minConductance);
       conductance.getFirst().get();
       conductance.getSecond().get();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • kcore

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       Pair<Scalar<Long>, VertexProperty<Integer, Long>> kcore = analyst.kcore(graph);
       kcore.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • kcore

      public <ID> Pair<Scalar<Long>,VertexProperty<ID,Long>> kcore(PgxGraph graph, int minCore, int maxCore) throws ExecutionException, InterruptedException

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      minCore - minimum k-core value.
      maxCore - maximum k-core value.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       Pair<Scalar<Long>, VertexProperty<Integer, Long>> kcore = analyst.kcore(graph, 0, 2147483647);
       kcore.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • kcore

      public <ID> Pair<Scalar<Long>,VertexProperty<ID,Long>> kcore(PgxGraph graph, Scalar<Long> maxKCore, VertexProperty<ID,Long> kcore) throws ExecutionException, InterruptedException

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      maxKCore - Scalar (long) for holding the value of the maximum k-core found by the algorithm.
      kcore - (out argument) vertex property with the largest k-core value for each vertex.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Long> scalar = graph.createScalar(PropertyType.LONG);
       VertexProperty<Integer, Long> prop = graph.CreateVertexProperty(PropertyType.LONG);
       Pair<Scalar<Long>, VertexProperty<Integer, Long>> kcore = analyst.kcore(graph, scalar, prop);
       kcore.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • kcore

      public <ID> Pair<Scalar<Long>,VertexProperty<ID,Long>> kcore(PgxGraph graph, int minCore, int maxCore, Scalar<Long> maxKCore, VertexProperty<ID,Long> kcore) throws ExecutionException, InterruptedException

      k-core decomposes a graph into layers revealing subgraphs with particular properties

      Definition

      A k-core is a maximal subgraph in which all of its vertices are connected and have the property that all of them have a degree of at least k. The k-cores can be regarded as layers in a graph, since a (k+1)-core will always be a subgraph of a k-core. This means that the larger k becomes, the smaller its k-core (i.e. its corresponding subgraph) will be. The k-core value (or coreness) assigned to a vertex will correspond to the core with the greatest degree from all the cores where it belongs. This implementation of k-core will look for cores lying within the interval set by the min_core and max_core input variables.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • K-Core can be used to analyze hierarchical structures in a graph by revealing subgraphs with particular properties. It can also help to visualize large graphs in 2D by using the "layers" provided by the k-cores.
      Parameters:
      graph - the graph.
      minCore - minimum k-core value.
      maxCore - maximum k-core value.
      maxKCore - Scalar (long) for holding the value of the maximum k-core found by the algorithm.
      kcore - (out argument) vertex property with the largest k-core value for each vertex.
      Returns:
      Pair holding the maximum core found and a node property with the largest k-core value for each node.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Long> scalar = graph.createScalar(PropertyType.LONG);
       VertexProperty<Integer, Long> prop = graph.CreateVertexProperty(PropertyType.LONG);
       Pair<Scalar<Long>, VertexProperty<Integer, Long>> kcore = analyst.kcore(graph, 0, 2147483647, scalar, prop);
       kcore.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + kcore.getSecond().getName() + " MATCH (x) ORDER BY x." + kcore.getSecond().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • diameter

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the diameter of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       Pair<Scalar<Integer>, VertexProperty<Integer, Integer>> diameter = analyst.diameter(graph);
       diameter.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + diameter.getSecond().getName() + " MATCH (x) ORDER BY x." + diameter.getSecond().getName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • diameter

      public <ID> Pair<Scalar<Integer>,VertexProperty<ID,Integer>> diameter(PgxGraph graph, Scalar<Integer> diameter, VertexProperty<ID,Integer> eccentricity) throws ExecutionException, InterruptedException

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      diameter - Scalar (integer) for holding the value of the diameter of the graph.
      eccentricity - (out argument) vertex property holding the eccentricity value for each vertex.
      Returns:
      Pair holding the diameter of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Integer> scalar = graph.createScalar(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> prop = graph.CreateVertexProperty(PropertyType.INTEGER);
       Pair<Scalar<Integer>, VertexProperty<Integer, Integer>> diameter = analyst.diameter(graph, scalar, prop);
       diameter.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + diameter.getSecond().getName() + " MATCH (x) ORDER BY x." + diameter.getSecond().getName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • radius

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      Pair holding the radius of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       Pair<Scalar<Integer>, VertexProperty<Integer, Integer>> diameter = analyst.radius(graph);
       radius.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + radius.getSecond().getName() + " MATCH (x) ORDER BY x." + radius.getSecond().getName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • radius

      public <ID> Pair<Scalar<Integer>,VertexProperty<ID,Integer>> radius(PgxGraph graph, Scalar<Integer> radius, VertexProperty<ID,Integer> eccentricity) throws ExecutionException, InterruptedException

      Diameter/radius gives an overview of the distances in a graph

      Definition

      The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will compute the eccentricity of all the vertices and will also return the diameter or radius value depending on the request. The algorithm will return an INF eccentricity and diameter/radius, for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortest paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      • diameterOn: true

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      radius - Scalar (integer) for holding the value of the radius of the graph.
      eccentricity - (out argument) vertex property holding the eccentricity value for each vertex.
      Returns:
      Pair holding the radius of the graph and a node property with eccentricity value for each node.

      Examples

       
       PgxGraph graph = ...;
       Scalar<Integer> scalar = graph.createScalar(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> prop = graph.CreateVertexProperty(PropertyType.INTEGER);
       Pair<Scalar<Integer>, VertexProperty<Integer, Integer>> diameter = analyst.radius(graph, scalar, prop);
       radius.getFirst().get();
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + radius.getSecond().getName() + " MATCH (x) ORDER BY x." + radius.getSecond().getName() +
         " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • periphery

      public <ID> VertexSet<ID> periphery(PgxGraph graph) throws ExecutionException, InterruptedException

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> periphery = analyst.periphery(graph);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • periphery

      public <ID> VertexSet<ID> periphery(PgxGraph graph, VertexSet<ID> periphery) throws ExecutionException, InterruptedException

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      periphery - (out argument) vertex set holding the vertices from the periphery or center of the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.createVertexSet();
       VertexSet<Integer> periphery = analyst.periphery(graph, vertices);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • center

      public <ID> VertexSet<ID> center(PgxGraph graph) throws ExecutionException, InterruptedException

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> center = analyst.center(graph);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • center

      public <ID> VertexSet<ID> center(PgxGraph graph, VertexSet<ID> center) throws ExecutionException, InterruptedException

      Periphery/center gives an overview of the extreme distances and the corresponding vertices in a graph

      Definition

      The periphery of a graph is the set of vertices that have an eccentricity value equal to the diameter of the graph. Similarly, the center is comprised by the set of vertices with eccentricity equal to the radius of the graph. The diameter of a graph is the maximal value of eccentricity of all the vertices in the graph, while the radius is the minimum graph eccentricity. The eccentricity of a vertex is the maximum distance via shortest paths to any other vertex in the graph. This algorithm will return the set of vertices from the periphery or the center of the graph, depending on the request. The algorithm will return a set with all the vertices for graphs with more than one strongly connected component.

      Implementation Details

      The implementation of this algorithm uses a parallel BFS method called Multi-Source BFS (MS-BSF) for a faster and more efficient search of the shortests paths. It still is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * E) with V = number of vertices, E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph - the graph.
      center - (out argument) vertex set holding the vertices from the periphery or center of the graph.
      Returns:
      vertex set holding the vertices from the periphery or center of the graph.

      Examples

       
       PgxGraph graph = ...;
       VertexSet<Integer> vertices = graph.createVertexSet();
       VertexSet<Integer> center = analyst.center(graph, vertices);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • localClusteringCoefficient

      public <ID> VertexProperty<ID,Double> localClusteringCoefficient(PgxGraph graph) throws ExecutionException, InterruptedException

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for undirected graphs. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> lcc = analyst.localClusteringCoefficient(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • localClusteringCoefficient

      public <ID> VertexProperty<ID,Double> localClusteringCoefficient(PgxGraph graph, VertexProperty<ID,Double> lcc) throws ExecutionException, InterruptedException

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for undirected graphs. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      lcc - (out argument)
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> prop = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> lcc = analyst.localClusteringCoefficient(graph, prop);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • localClusteringCoefficient

      public <ID> VertexProperty<ID,Double> localClusteringCoefficient(PgxGraph graph, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for undirected graphs. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> lcc = analyst.localClusteringCoefficient(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • localClusteringCoefficient

      public <ID> VertexProperty<ID,Double> localClusteringCoefficient(PgxGraph graph, VertexProperty<ID,Double> lcc, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      LCC gives information about potential clustering options in a graph

      Definition

      The LCC of a vertex V is the fraction of connections between each pair of neighbors of V, i.e. the fraction of existing triangles from all the possible triangles involving V and every other pair of neighbor vertices of V. This implementation is intended for undirected graphs. Nodes with a degree smaller than 2 will be assigned a LCC value of 0.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V ^ 2) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • LCC can be used to determine how likely are vertices to cluster together, since it assess the degree of connections between a vertex and its neighbors. It could be used in social networks to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      lcc - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      vertex property holding the lcc value for each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Double> prop = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, Double> lcc = analyst.localClusteringCoefficient(graph, prop);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + lcc.getName() + " MATCH (x) ORDER BY x." + lcc.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • findCycle

      public <ID> PgxPath<ID> findCycle(PgxGraph graph) throws ExecutionException, InterruptedException

      Find cycle looks for any loop in the graph.

      Definition

      This algorithm tries to find a cycle in a directed graph using DFS traversals and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. The algorithm is expensive because it will perform DFS traversals using different vertices as starting points until it explores the whole graph (worst-case scenario), or until it finds a cycle.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(5 * V + E) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       PgxPath<Integer> cycle = analyst.findCycle(graph);
       cycle.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • findCycle

      public <ID> PgxPath<ID> findCycle(PgxGraph graph, VertexSequence<ID> nodeSeq, EdgeSequence edgeSeq) throws ExecutionException, InterruptedException

      Find cycle looks for any loop in the graph.

      Definition

      This algorithm tries to find a cycle in a directed graph using DFS traversals and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. The algorithm is expensive because it will perform DFS traversals using different vertices as starting points until it explores the whole graph (worst-case scenario), or until it finds a cycle.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature. It is an expensive algorithm to run on large graphs.

      Complexity

      • Time: O(V * (V + E)) with V = number of vertices, E = number of edges
      • Space: O(5 * V + E) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      nodeSeq - (out argument) vertex sequence holding the vertices in the cycle.
      edgeSeq - (out argument) edge sequence holding the edges in the cycle.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       VertexSequence<Integer> nodeSeq = graph.createVertexSequence();
       EdgeSequence edgeSeq = graph.createEdgeSequence();
       PgxPath<Integer> cycle = analyst.findCycle(graph, nodeSeq, edgeSeq);
       cycle.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • findCycle

      public <ID> PgxPath<ID> findCycle(PgxGraph graph, PgxVertex<ID> src) throws ExecutionException, InterruptedException

      Find cycle looks for any loop in the graph.

      Definition

      This implementation tries to find a cycle in a directed graph using the given vertex as starting point for the DFS traversal and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. Restricting the DFS traversal to a single starting point means that some parts of the graph may not get explored.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(4 * V + E) with V = number of vertices, E = number of edges

      Default Values

      • s: 0

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      src - source vertex for the search.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       PgxPath<Integer> cycle = analyst.findCycle(graph, vertex);
       cycle.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • findCycle

      public <ID> PgxPath<ID> findCycle(PgxGraph graph, PgxVertex<ID> src, VertexSequence<ID> nodeSeq, EdgeSequence edgeSeq) throws ExecutionException, InterruptedException

      Find cycle looks for any loop in the graph.

      Definition

      This implementation tries to find a cycle in a directed graph using the given vertex as starting point for the DFS traversal and will return the first cycle found, if there is one. In such case, the vertices and edges involved in the cycle will be returned in the order of visit. Restricting the DFS traversal to a single starting point means that some parts of the graph may not get explored.

      Implementation Details

      The implementation of this algorithm uses a built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(4 * V + E) with V = number of vertices, E = number of edges

      Default Values

      • s: 0

      Applications

      • Cycles in a graph can be useful in problems related to routes and flows.
      Parameters:
      graph - the graph.
      src - source vertex for the search.
      nodeSeq - (out argument) vertex sequence holding the vertices in the cycle.
      edgeSeq - (out argument) edge sequence holding the edges in the cycle.
      Returns:
      PgxPath representing the cycle as path, if exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexSequence<Integer> nodeSeq = graph.createVertexSequence();
       EdgeSequence edgeSeq = graph.createEdgeSequence();
       PgxPath<Integer> cycle = analyst.findCycle(graph, vertex, nodeSeq, edgeSeq);
       cycle.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • reachability

      public <ID> Integer reachability(PgxGraph graph, PgxVertex<ID> source, PgxVertex<ID> dest, int maxHops, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Reachability is a fast way to check if two vertices are reachable from each other.

      Definition

      This algorithm tries to find if the destination vertex is reachable given the source vertex and the maximum hop distance set by the user. The search can be performed in a directed or undirected way. These options may lead to different hop distances, since an undirected search has less restrictions on the possible paths connecting vertices than the directed option. Hence hop distances from an undirected search can be smaller than the ones from the directed cases.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(1)

      Default Values

      Applications

      • Check connectivity between vertices in a graph.
      Parameters:
      graph - the graph.
      source - source vertex for the search.
      dest - destination vertex for the search.
      maxHops - maximum hop distance between the source and destination vertices.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      the number of hops between the vertices. It will return -1 if the vertices are not connected or are not reachable given the condition of the maximum hop distance allowed.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       integer result = analyst.reachability(graph, src, dst, 2, false);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • topologicalSort

      public <ID> VertexProperty<ID,Integer> topologicalSort(PgxGraph graph) throws ExecutionException, InterruptedException

      Topological sort gives an order of visit for vertices in directed acyclic graphs

      Definition

      Topological sort tries to set an order over the vertices in a graph using the direction of the edges. A directed graph has a topological order if and only if it has no cycles, i.e. it is a directed acyclic graph. The algorithm visits the vertices in a DFS-like fashion to set up their order. The order of the vertices is returned as a vertex property, and the values will be set to -1 if there is a cycle in the graph.

      Implementation Details

      The implementation of this algorithm is sequential due the ordering constraint.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      Returns:
      vertex property holding the topological order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> topoSort = analyst.topologicalSort(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + topoSort.getName() + " WHERE (x) ORDER BY x." + topoSort.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • topologicalSort

      public <ID> VertexProperty<ID,Integer> topologicalSort(PgxGraph graph, VertexProperty<ID,Integer> topoSort) throws ExecutionException, InterruptedException

      Topological sort gives an order of visit for vertices in directed acyclic graphs

      Definition

      Topological sort tries to set an order over the vertices in a graph using the direction of the edges. A directed graph has a topological order if and only if it has no cycles, i.e. it is a directed acyclic graph. The algorithm visits the vertices in a DFS-like fashion to set up their order. The order of the vertices is returned as a vertex property, and the values will be set to -1 if there is a cycle in the graph.

      Implementation Details

      The implementation of this algorithm is sequential due the ordering constraint.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      topoSort - (out argument) vertex property holding the topological order of each vertex.
      Returns:
      vertex property holding the topological order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> prop = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> topoSort = analyst.topologicalSort(graph, prop);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + topoSort.getName() + " WHERE (x) ORDER BY x." + topoSort.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • topologicalSchedule

      public <ID> VertexProperty<ID,Integer> topologicalSchedule(PgxGraph graph, VertexSet<ID> source) throws ExecutionException, InterruptedException

      Topological schedule gives an order of visit for the reachable vertices from the source

      Definition

      Topological schedule sets an order over the vertices in a graph based on the proximity these have to the vertices from the given source. The algorithm does a BFS traversal for each vertex from the source set in order to assign the correct scheduling order to all the reachable, even if the graph is undirected or has cycles. The vertices that are not reachable will be assigned a value of -1.

      Implementation Details

      The implementation of this algorithm uses a built-in BFS feature.

      Complexity

      • Time: O(k * (V + E)) with V = number of vertices, E = number of edges, k = size of the source set
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      source - set of vertices to be used as the starting points for the scheduling order.
      Returns:
      vertex property holding the scheduled order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> topoSched = analyst.topologicalSchedule(graph, source);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + topoSched.getName() + " WHERE (x) ORDER BY x." + topoSched.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • topologicalSchedule

      public <ID> VertexProperty<ID,Integer> topologicalSchedule(PgxGraph graph, VertexSet<ID> source, VertexProperty<ID,Integer> topoSched) throws ExecutionException, InterruptedException

      Topological sort gives an order of visit for vertices in directed acyclic graphs

      Definition

      Topological sort tries to set an order over the vertices in a graph using the direction of the edges. A directed graph has a topological order if and only if it has no cycles, i.e. it is a directed acyclic graph. The algorithm visits the vertices in a DFS-like fashion to set up their order. The order of the vertices is returned as a vertex property, and the values will be set to -1 if there is a cycle in the graph.

      Implementation Details

      The implementation of this algorithm is sequential due the ordering constraint.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful for tasks involving serialization and dependencies.
      Parameters:
      graph - the graph.
      source - set of vertices to be used as the starting points for the scheduling order.
      topoSched - (out argument) vertex property holding the scheduled order of each vertex.
      Returns:
      vertex property holding the scheduled order of each vertex.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Integer> prop = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, Integer> topoSched = analyst.topologicalSchedule(graph, source, prop);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + topoSched.getName() + " WHERE (x) ORDER BY x." + topoSched.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • outDegreeDistribution

      public PgxMap<Integer,Long> outDegreeDistribution(PgxGraph graph) throws ExecutionException, InterruptedException

      Out-degree distribution gives information about the outgoing flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the out-degree (i.e. just outgoing edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      Returns:
      map holding a histogram of the node degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<Integer, Long> degree = analyst.outDegreeDistribution(graph);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • outDegreeDistribution

      public PgxMap<Integer,Long> outDegreeDistribution(PgxGraph graph, PgxMap<Integer,Long> distribution) throws ExecutionException, InterruptedException

      Out-degree distribution gives information about the outgoing flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the out-degree (i.e. just outgoing edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      distribution - (out argument)
      Returns:
      map holding a histogram of the node degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<Integer, Long> distribution = graph.createMap(PropertyType.INTEGER, PropertyType.LONG);
       PgxMap<Integer, Long> degree = analyst.outDegreeDistribution(graph, distribution);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • inDegreeDistribution

      public PgxMap<Integer,Long> inDegreeDistribution(PgxGraph graph) throws ExecutionException, InterruptedException

      In-degree distribution gives information about the incoming flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the in-degree (i.e. just incoming edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      Returns:
      map holding a histogram of the vertex degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<Integer, Long> degree = analyst.inDegreeDistribution(graph);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • inDegreeDistribution

      public PgxMap<Integer,Long> inDegreeDistribution(PgxGraph graph, PgxMap<Integer,Long> distribution) throws ExecutionException, InterruptedException

      In-degree distribution gives information about the incoming flows in a graph

      Definition

      This version of the degree distribution will return a map with the distribution of the in-degree (i.e. just incoming edges) of the graph. For undirected graphs the algorithm will consider all the edges (incoming and outgoing) for the distribution.

      Implementation Details

      This algorithm runs in a sequential way. It uses a map with type int for the keys and type long for storing the mapped values of the distribution, like a histogram.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Degree distribution is a basic structural property of a graph which can help to characterize and classify them.
      Parameters:
      graph - the graph.
      distribution - (out argument)
      Returns:
      map holding a histogram of the vertex degrees in the graph.

      Examples

       
       PgxGraph graph = ...;
       PgxMap<Integer, Long> distribution = graph.createMap(PropertyType.INTEGER, PropertyType.LONG);
       PgxMap<Integer, Long> degree = analyst.inDegreeDistribution(graph, distribution);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • fattestPath

      public <ID> AllPaths<ID> fattestPath(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity) throws ExecutionException, InterruptedException

      Fattest path is a fast algorithm for finding a shortest path adding constraints for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       AllPaths<Integer> fattestPath = analyst.fattestPath(graph, root, cost);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • fattestPath

      public <ID> AllPaths<ID> fattestPath(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Fattest path is a fast algorithm for finding a shortest path adding constraints for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      distance - (out argument) vertex property holding the capacity value of the fattest path up to the current vertex. The fatness value for the source vertex will be INF, while it will be 0 for all the vertices that are not reachable from the source.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the fattest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> fattestPath = analyst.fattestPath(graph, root, cost, distance, parent, parentEdge);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • fattestPath

      public <ID> AllPaths<ID> fattestPath(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected Fattest path is variation of the fattest graph algorithm that ignores edge directions. for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       AllPaths<Integer> fattestPath = analyst.fattestPath(graph, root, cost, true);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • fattestPath

      public <ID> AllPaths<ID> fattestPath(PgxGraph graph, PgxVertex<ID> root, EdgeProperty<Double> capacity, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected Fattest path is variation of the fattest graph algorithm that ignores edge directions. for flowing related matters

      Definition

      The Fattest path algorithm can be regarded as a variant of Dijkstra's algorithm, it tries to find the fattest path between the given source and all the reachable vertices in the graph. The fatness of a path is equal to the minimum value of the capacity from the edges that take part in the path, thus a fattest path is conformed by the edges with the largest possible capacity.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      capacity - edge property holding the capacity of each edge in the graph.
      distance - (out argument) vertex property holding the capacity value of the fattest path up to the current vertex. The fatness value for the source vertex will be INF, while it will be 0 for all the vertices that are not reachable from the source.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the fattest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      AllPaths holding the information of the possible fattest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> root = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> fattestPath = analyst.fattestPath(graph, root, cost, distance, parent, parentEdge, true);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • sccKosaraju

      public <ID> Partition<ID> sccKosaraju(PgxGraph graph) throws ExecutionException, InterruptedException

      Kosaraju finds strongly connected components in a graph

      Definition

      Kosaraju's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS and BFS features.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> scc = analyst.sccKosaraju(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • sccKosaraju

      public <ID> Partition<ID> sccKosaraju(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution) throws ExecutionException, InterruptedException

      Kosaraju finds strongly connected components in a graph

      Definition

      Kosaraju's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS and BFS features.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the SCC assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> scc = analyst.sccKosaraju(graph, pd);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • sccTarjan

      public <ID> Partition<ID> sccTarjan(PgxGraph graph) throws ExecutionException, InterruptedException

      Tarjan finds strongly connected components in a graph

      Definition

      Tarjan's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> scc = analyst.sccTarjan(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • sccTarjan

      public <ID> Partition<ID> sccTarjan(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution) throws ExecutionException, InterruptedException

      Tarjan finds strongly connected components in a graph

      Definition

      Tarjan's algorithm works on directed graphs for finding strongly connected components (SCC). A SCC is a maximal subset of vertices of the graph with the particular characteristic that every vertex in the SCC can be reachable from any other other vertex in the SCC.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(5 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and, in social networks, to spot out groups of people (communities), since people in groups tend to have a high density of links between them.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the SCC assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> scc = analyst.sccTarjan(graph, pd);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + scc.getPropertyName() + " MATCH (x) ORDER BY x." + scc.getPropertyName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • wcc

      public <ID> Partition<ID> wcc(PgxGraph graph) throws ExecutionException, InterruptedException

      Identifying weakly connected components can be useful for clustering graph data

      Definition

      This algorithm finds weakly connected components (WCC) in a directed graph. A WCC is a maximal subset of vertices of the graph with the particular characteristic that for every pair of vertices U and V in the WCC there must be a path connecting U to V, ignoring the direction of edges. It is a non-deterministic algorithm because of its parallelized implementation.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * d) with d = diameter of the graph
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and analysis in social networks.
      Parameters:
      graph - the graph.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       Partition<Integer> wcc = analyst.wcc(graph);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + wcc.getPropertyName() + " MATCH (x) ORDER BY x." + wcc.getPropertyName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • wcc

      public <ID> Partition<ID> wcc(PgxGraph graph, VertexProperty<ID,Long> partitionDistribution) throws ExecutionException, InterruptedException

      Identifying weakly connected components can be useful for clustering graph data

      Definition

      This algorithm finds weakly connected components (WCC) in a directed graph. A WCC is a maximal subset of vertices of the graph with the particular characteristic that for every pair of vertices U and V in the WCC there must be a path connecting U to V, ignoring the direction of edges. It is a non-deterministic algorithm because of its parallelized implementation.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * d) with d = diameter of the graph
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • It can be used for clustering and analysis in social networks.
      Parameters:
      graph - the graph.
      partitionDistribution - vertex property holding the label of the WCC assigned to each vertex.
      Returns:
      Partition holding the node collections corresponding to the components found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       VertexProperty<Integer, Long> pd = graph.createVertexProperty(PropertyType.LONG);
       Partition<Integer> wcc = analyst.wcc(graph, pd);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + wcc.getPropertyName() + " MATCH (x) ORDER BY x." + wcc.getPropertyName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • shortestPathDijkstra

      public <ID> PgxPath<ID> shortestPathDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException

      Dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxPath<Integer> path = analyst.shortestPathDijkstra(graph, src, dst, cost);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstra

      public <ID> PgxPath<ID> shortestPathDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathDijkstra(graph, src, dst, cost, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathMultiDestinationDijkstra

      public <ID> AllPaths<ID> shortestPathMultiDestinationDijkstra(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException

      Dijkstra is a fast algorithm for finding a shortest path in a graph and goes to all destinations.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path (if there is one) which goes from a single source to all destinations, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       AllPaths<Integer> path = analyst.shortestPathMultiDestinationDijkstra(graph, src, cost);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathMultiDestinationDijkstra

      public <ID> AllPaths<ID> shortestPathMultiDestinationDijkstra(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Dijkstra is a fast algorithm for finding a shortest path in a graph and goes to all destinations.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path (if there is one) which goes from a single source to all destinations, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      distance - (out argument) vertex property holding the distance to the source vertex for each vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<ID> promise = analyst.shortestPathMultiDestinationDijkstra(graph, src, cost, distance, parent,
        parentEdge);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstra

      public <ID> PgxPath<ID> shortestPathFilteredDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr) throws ExecutionException, InterruptedException

      Filtered Dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstra(graph, src, dst, cost, filter);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstra

      public <ID> PgxPath<ID> shortestPathFilteredDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Filtered Dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstra(graph, src, dst, cost, filter, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstra

      public <ID> PgxPath<ID> shortestPathFilteredDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected filtered djkstra is variation of the filtered djkstra's algorithm that ignores edge directions.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path ignoring edges directions for directed graphs while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices .

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstra(graph, src, dst, cost, filter);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstra

      public <ID> PgxPath<ID> shortestPathFilteredDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected filtered djkstra is variation of the filtered djkstra's algorithm that ignores edge directions.

      Definition

      This variant of the Dijkstra's algorithm tries to find the shortest path ignoring edges directions for directed graphs while also taking into account a filter expression, which will add restrictions over the potential edges when looking for the shortest path between the source and destination vertices .

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstra(graph, src, dst, cost, filter, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException

      Bidirectional dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxPath<Integer> path = analyst.shortestPathDijkstraBidirectional(graph, src, dst, cost);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Bidirectional dijkstra is a fast algorithm for finding a shortest path in a graph

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathDijkstraBidirectional(graph, src, dst, cost, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected bidirectional dijkstra is a variant of bidirectional dijkstra that ignores edge directions

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxPath<Integer> path = analyst.shortestPathDijkstraBidirectional(graph, src, dst, cost);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected bidirectional dijkstra is a variant of bidirectional dijkstra that ignores edge directions

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      parent - (out argument)
      parentEdge - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathDijkstraBidirectional(graph, src, dst, cost, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstra

      public <ID> PgxPath<ID> shortestPathDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected Dijkstra's algorithm is a variant of Dijkstra's algorithm that ignores edge directions.

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxPath<Integer> path = analyst.shortestPathDijkstra(graph, src, dst, cost);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstra

      public <ID> PgxPath<ID> shortestPathDijkstra(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Undirected Dijkstra's algorithm is a variant of Dijkstra's algorithm that ignores edge directions.

      Definition

      Dijkstra's algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(4 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the (positive) weight of each edge in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges during the search.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathDijkstra(graph, src, dst, cost, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathFilteredDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr) throws ExecutionException, InterruptedException

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstraBidirectional(graph, src, dst, cost, filter);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathFilteredDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstraBidirectional(
         graph, src, dst, cost, filter, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathFilteredDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstraBidirectional(graph, src, dst, cost, filter);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathFilteredDijkstraBidirectional(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Bidirectional dijkstra is a fast algorithm for finding a shortest path while also filtering edges

      Definition

      This variant of the Dijkstra's algorithm searches for shortest path in two ways, it does a forward search from the source vertex and a backwards one from the destination vertex, while also adding the corresponding restrictions on the edges given by the filter expression. If the path between the vertices exists, both searches will meet each other at an intermediate point.

      Implementation Details

      This algorithm runs in a sequential way.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(10 * V) with V = number of vertices

      Default Values

      • src: 0
      • dst: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      dst -
      cost -
      filterExpr -
      parent - (out argument)
      parentEdge - (out argument)
      ignoreEdgeDirection - boolean flag for ignoring the direction of the edges
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeFilter filter = EdgeFilter.fromExpression("edge.cost > 5");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<Integer> path = analyst.shortestPathFilteredDijkstraBidirectional(
         graph, src, dst, cost, filter, parent, parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFord

      public <ID> AllPaths<ID> shortestPathBellmanFord(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       AllPaths<Integer> paths = analyst.shortestPathBellmanFord(graph, src, cost);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFord

      public <ID> AllPaths<ID> shortestPathBellmanFord(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      distance - (out argument) vertex property holding the distance to the source vertex for each vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> paths = analyst.shortestPathBellmanFord(graph, src, cost, distance, parent, parentEdge);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFord

      public <ID> AllPaths<ID> shortestPathBellmanFord(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       AllPaths<Integer> paths = analyst.shortestPathBellmanFord(graph, src, cost, true);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFord

      public <ID> AllPaths<ID> shortestPathBellmanFord(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge, boolean ignoreEdgeDirection) throws ExecutionException, InterruptedException

      Bellman-ford finds multiple shortest paths at the same time

      Definition

      Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      distance - (out argument) vertex property holding the distance to the source vertex for each vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> paths = analyst.shortestPathBellmanFord(graph, src, cost, distance, parent,
         parentEdge, true);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFordReverse

      public <ID> AllPaths<ID> shortestPathBellmanFordReverse(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException

      Reversed bellman-ford finds multiple shortest paths at the same time

      Definition

      This variant of the Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices in a reversed fashion using the incoming edges instead of the outgoing, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      cost -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       AllPaths<Integer> paths = analyst.shortestPathBellmanFordReverse(graph, src, cost);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFordReverse

      public <ID> AllPaths<ID> shortestPathBellmanFordReverse(PgxGraph graph, PgxVertex<ID> src, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Reversed bellman-ford finds multiple shortest paths at the same time

      Definition

      This variant of the Bellman-Ford algorithm tries to find the shortest path (if there is one) between the given source and destination vertices in a reversed fashion using the incoming edges instead of the outgoing, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph -
      src -
      cost -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> paths = analyst.shortestPathBellmanFordReverse(graph, src, cost, distance, parent, parentEdge);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFordSingleDestination

      public <ID> PgxPath<ID> shortestPathBellmanFordSingleDestination(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException

      Bellman-ford single destination finds a shortest path in a graph

      Definition

      This variant of Bellman-Ford's algorithm tries the to find the shortest path (if there is one) from a single source to all destination, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0
      • dest: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       PgxPath<Integer> path = analyst.shortestPathBellmanFordSingleDestination(graph, src, dst, cost);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFordSingleDestination

      public <ID> PgxPath<ID> shortestPathBellmanFordSingleDestination(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Bellman-ford single destination finds a shortest path in a graph

      Definition

      This variant of Bellman-Ford's algorithm tries the to find the shortest path (if there is one) from a single source to all destination, while minimizing the distance or cost associated to each edge in the graph.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(6 * V) with V = number of vertices

      Default Values

      • root: 0
      • dest: 1000

      Applications

      • This algorithm can be implemented in optimization problems that can be represented with a graph structure.
      Parameters:
      graph - the graph.
      src - the source vertex from the graph for the path.
      dst - the destination vertex from the graph for the path.
      cost - edge property holding the weight of each edge in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each vertex in the shortest path.
      parentEdge - (out argument) vertex property holding the edge ID linking the current vertex in the path with the previous vertex in the path.
      Returns:
      PgxPath holding the information of the shortest path, if it exists.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       PgxVertex<Integer> dst = graph.getVertex(333);
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       PgxPath<ID> promise = analyst.shortestPathBellmanFordSingleDestination(graph, src, dst, cost, parent,
        parentEdge);
       path.getPathLengthWithCost();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDist

      public <ID> AllPaths<ID> shortestPathHopDist(PgxGraph graph, PgxVertex<ID> src) throws ExecutionException, InterruptedException

      Hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each vertex with respect to the given source vertex in the input and will also return the parent vertex and linking edge for each vertex. The returned information allows to trace back shortest paths from any reachable vertex to the source vertex.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       AllPaths<Integer> paths = analyst.shortestPathHopDist(graph, src);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDist

      public <ID> AllPaths<ID> shortestPathHopDist(PgxGraph graph, PgxVertex<ID> src, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each vertex with respect to the given source vertex in the input and will also return the parent vertex and linking edge for each vertex. The returned information allows to trace back shortest paths from any reachable vertex to the source vertex.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> paths = analyst.shortestPathHopDist(graph, src, distance, parent, parentEdge);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDistReverse

      public <ID> AllPaths<ID> shortestPathHopDistReverse(PgxGraph graph, PgxVertex<ID> src) throws ExecutionException, InterruptedException

      Backwards hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       AllPaths<Integer> paths = analyst.shortestPathHopDistReverse(graph, src);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDistReverse

      public <ID> AllPaths<ID> shortestPathHopDistReverse(PgxGraph graph, PgxVertex<ID> src, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Backwards hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> paths = analyst.shortestPathHopDistReverse(graph, src, distance, parent, parentEdge);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDistUndirected

      public <ID> AllPaths<ID> shortestPathHopDistUndirected(PgxGraph graph, PgxVertex<ID> src) throws ExecutionException, InterruptedException

      Undirected hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       AllPaths<Integer> paths = analyst.shortestPathHopDistUndirected(graph, src);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDistUndirected

      public <ID> AllPaths<ID> shortestPathHopDistUndirected(PgxGraph graph, PgxVertex<ID> src, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException

      Undirected hop distance can give a relatively fast insight on the distances in a graph

      Definition

      The Hop distance of two vertices S and V in a graph is the number of edges that are in a shortest path connecting them. This algorithm will return the distance of each node with respect to the given source node in the input and will also return the parent node and linking edge for each node. The returned information allows to trace back shortest paths from any reachable node to the source node.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • This algorithm computes a basic structural graph property that is useful when looking for distances in a graph.
      Parameters:
      graph -
      src -
      distance - (out argument)
      parent - (out argument)
      parentEdge - (out argument)
      Returns:
      AllPaths holding the information of the possible shortest paths from the source node.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> src = graph.getVertex(128);
       VertexProperty<Integer, Double> distance = graph.createVertexProperty(PropertyType.DOUBLE);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       VertexProperty<Integer, PgxEdge> parentEdge = graph.createVertexProperty(PropertyType.EDGE);
       AllPaths<Integer> paths = analyst.shortestPathHopDistUndirected(graph, src, distance, parent, parentEdge);
       
       
      Throws:
      ExecutionException
      InterruptedException
    • matrixFactorizationGradientDescent

      public <ID> MatrixFactorizationModel<ID> matrixFactorizationGradientDescent(BipartiteGraph graph, EdgeProperty<Double> weight) throws InterruptedException, ExecutionException

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       MatrixFactorizationModel<Integer> matrix = analyst.matrixFactorizationGradientDescent(graph, cost);
       matrix.getRootMeanSquareError();
       
       
      Throws:
      InterruptedException
      ExecutionException
      See Also:
    • matrixFactorizationGradientDescent

      public <ID> MatrixFactorizationModel<ID> matrixFactorizationGradientDescent(BipartiteGraph graph, EdgeProperty<Double> weight, VertexProperty<ID,PgxVect<Double>> features) throws InterruptedException, ExecutionException

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      features - (out argument) vertex property holding the generated feature vectors for each vertex.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVect<Double>> features = graph.createVertexVectorProperty(PropertyType.DOUBLE, 20);
       MatrixFactorizationModel<Integer> matrix = analyst.matrixFactorizationGradientDescent(graph, cost, features);
       matrix.getRootMeanSquareError();
       
       
      Throws:
      InterruptedException
      ExecutionException
      See Also:
    • matrixFactorizationGradientDescent

      public <ID> MatrixFactorizationModel<ID> matrixFactorizationGradientDescent(BipartiteGraph graph, EdgeProperty<Double> weight, double learningRate, double changePerStep, double lambda, int maxStep, int vectorLength, VertexProperty<ID,PgxVect<Double>> features) throws InterruptedException, ExecutionException

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      learningRate - learning rate for the optimization process.
      changePerStep - parameter used to modulate the learning rate during the optimization process.
      lambda - penalization parameter to avoid overfitting during optimization process.
      maxStep - maximum number of iterations that will be performed.
      vectorLength - size of the feature vectors to be generated for the factorization.
      features - (out argument) vertex property holding the generated feature vectors for each vertex.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       VertexProperty<Integer, PgxVect<Double>> features = graph.createVertexVectorProperty(PropertyType.DOUBLE, 20);
       MatrixFactorizationModel<Integer> matrix = analyst.matrixFactorizationGradientDescent(
         graph, cost, 0.1, 0.9, 0.1, 100, 20, features);
       matrix.getRootMeanSquareError();
       
       
      Throws:
      InterruptedException
      ExecutionException
      See Also:
    • matrixFactorizationGradientDescent

      public <ID> MatrixFactorizationModel<ID> matrixFactorizationGradientDescent(BipartiteGraph graph, EdgeProperty<Double> weight, double learningRate, double changePerStep, double lambda, int maxStep, int vectorLength) throws InterruptedException, ExecutionException

      Matrix factorization can be used as a recommendation algorithm for bipartite graphs

      Definition

      This algorithm needs a [bipartite](prog-guides/mutation-subgraph/subgraph.html#create-a-bipartite-subgraph-based-on-a-vertex-list) graph to generate feature vectors that factorize the given set of left vertices (users) and right vertices (items), so that the inner product of such feature vectors can recover the information from the original graph structure, which can be seen as a sparse matrix. The generated feature vectors can be used for making recommendations with the given set of users, where a good recommendation for a given user will be a dot (inner) product between the feature vector of the user and the corresponding feature vector of a vertex from the item set, such that the result of that dot product returns a high score.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(E * k * s) with E = number of edges, k = maximum number of iteration, s = size of the feature vectors
      • Space: O(2 * V * s) with V = number of vertices, s = size of the feature vectors

      Default Values

      Applications

      • This algorithm can be used to get recommendations. The computed feature vectors can also be used to make predictions.
      Parameters:
      graph - Bipartite graph.
      weight - edge property holding the rating weight of each edge in the graph. The weight needs to be pre-scaled into the range 1-5. If the weight values are not between 1 and 5, the result will become inaccurate.
      learningRate - learning rate for the optimization process.
      changePerStep - parameter used to modulate the learning rate during the optimization process.
      lambda - penalization parameter to avoid overfitting during optimization process.
      maxStep - maximum number of iterations that will be performed.
      vectorLength - size of the feature vectors to be generated for the factorization.
      Returns:
      Matrix factorization model holding the feature vectores found by the algorithm.

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       MatrixFactorizationModel<Integer> matrix = analyst.matrixFactorizationGradientDescent(
         graph, cost, 0.1, 0.9, 0.1, 100, 20);
       matrix.getRootMeanSquareError();
       
       
      Throws:
      InterruptedException
      ExecutionException
      See Also:
    • matrixFactorizationRecommendations

      public <ID> VertexProperty<ID,Double> matrixFactorizationRecommendations(BipartiteGraph graph, PgxVertex<ID> user, int vectorLength, VertexProperty<ID,PgxVect<Double>> feature, VertexProperty<ID,Double> estimatedRating) throws InterruptedException, ExecutionException

      Estimate rating can be used as a prediction algorithm for bipartite graphs

      Definition

      This algorithm is a complement for Matrix Factorization, thus it needs a bipartite graph and the generated feature vectors from such algorithm. The generated feature vectors will be used for making predictions in cases where the given user vertex has not been related to a particular item from the item set. Similarly to the recommendations from matrix factorization, this algorithm will perform dot products between the given user vertex and the rest of vertices in the graph, giving a score of 0 to the items that are already related to the user and to the products with other user vertices, hence returning the results of the dot products for the unrelated item vertices. The scores from those dot products can be interpreted as the predicted scores for the unrelated items given a particular user vertex.

      Implementation Details

      This algorithm is designed to run in parallel given its high degree of parallelization.

      Complexity

      • Time: O(V) with V = number of vertices
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • This algorithm uses computed feature vectors from Matrix Factorization to make predictions about unrelated vertices from the item set (right vertices in the bipartite graph.
      Parameters:
      graph - Bipartite graph.
      user - vertex from the left (user) side of the graph.
      vectorLength - size of the feature vectors.
      feature - vertex property holding the feature vectors for each vertex.
      estimatedRating - (out argument) vertex property holding the estimated rating score for each vertex.
      Returns:
      vertex property holding the estimated rating score for each vertex.
      Throws:
      InterruptedException
      ExecutionException
      See Also:
    • prim

      prim reveals tree structures with shortest paths in a graph

      Definition

      This implementation of Prim's algorithm works on undirected graphs that are connected and have no multi-edges (i.e. more than one edge connecting the same pair of vertices). The algorithm computes the minimum spanning tree (MST) of the graph using the weights associated to each edge. A minimum spanning tree is a subset of the edges that connects all the vertices in the graph such that it minimizes the total weight associated to the edges.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(2 * E + V) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • The trees found with Prim's algorithm can be used to simplify the design of networks when just looking to connect all the elements on the network, like in computer or transportation networks. It can also be used to generate mazes using the structure of a graph.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      Returns:
      edge property holding the edges belonging to the minimum spanning tree of the graph (i.e. all the edges with in_mst=true).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeProperty<Boolean> prim = analyst.prim(graph, cost);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + prim.getName() + " MATCH (x) ORDER BY x." + prim.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • prim

      prim reveals tree structures with shortest paths in a graph

      Definition

      This implementation of Prim's algorithm works on undirected graphs that are connected and have no multi-edges (i.e. more than one edge connecting the same pair of vertices). The algorithm computes the minimum spanning tree (MST) of the graph using the weights associated to each edge. A minimum spanning tree is a subset of the edges that connects all the vertices in the graph such that it minimizes the total weight associated to the edges.

      Implementation Details

      The implementation of this algorithm uses an iterative method.

      Complexity

      • Time: O(E + V log V) with V = number of vertices, E = number of edges
      • Space: O(2 * E + V) with V = number of vertices, E = number of edges

      Default Values

      Applications

      • The trees found with Prim's algorithm can be used to simplify the design of networks when just looking to connect all the elements on the network, like in computer or transportation networks. It can also be used to generate mazes using the structure of a graph.
      Parameters:
      graph - the graph.
      weight - edge property holding the weight of each edge in the graph.
      mst - (out argument) edge property holding the edges belonging to the minimum spanning tree of the graph (i.e. all the edges with in_mst=true).
      Returns:
      edge property holding the edges belonging to the minimum spanning tree of the graph (i.e. all the edges with in_mst=true).

      Examples

       
       PgxGraph graph = ...;
       EdgeProperty<Double> cost = graph.getEdgeProperty("cost");
       EdgeProperty<Boolean> mst = graph.createEdgeProperty(PropertyType.BOOLEAN);
       EdgeProperty<Boolean> prim = analyst.prim(graph, cost, mst);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + prim.getName() + " MATCH (x) ORDER BY x." + prim.getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root, int maxDepth) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex, 2);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex, navigator);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, int maxDepth) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex, navigator, 2);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex, navigator, true);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex, navigator, true, 2);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex, navigator, true, distance, parent);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent) throws ExecutionException, InterruptedException

      A Breadth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the BFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in BFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(2 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using BFS.
      • You can use BFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> bfs =
         analyst.filteredBfs(graph, vertex, navigator, true, distance, parent);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + bfs.getFirst().getName() + ", x." + bfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         bfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root, int maxDepth) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex, 2);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex, navigator);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, int maxDepth) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex, navigator, 2);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex, navigator, true);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex, navigator, true, 2);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex, navigator, true, distance, parent);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, PgxVertex<ID> root, VertexFilter navigator, boolean initWithInf, int maxDepth, VertexProperty<ID,Integer> distance, VertexProperty<ID,PgxVertex<ID>> parent) throws ExecutionException, InterruptedException

      A Depth-First Search implementation with an option to filter edges during the traversal of the graph.

      Definition

      This filtered version of the DFS algorithm allows to use a filter and a navigator expression to be evaluated over the vertices during the traversal and discriminate them according to the desired criteria. It will return the distance to the source vertex and the corresponding parent vertex for all the filtered vertices.

      Implementation Details

      The implementation of this algorithm uses the built-in DFS feature.

      Complexity

      • Time: O(V + E) with V = number of vertices, E = number of edges
      • Space: O(3 * V) with V = number of vertices

      Default Values

      Applications

      • In social networks, you can find people within a given distance from a person using DFS.
      • You can use DFS to find if there is a path between two vertices.
      Parameters:
      graph - the graph.
      root - the source vertex from the graph for the path.
      navigator - navigator expression to be evaluated on the vertices during the graph traversal.
      initWithInf - boolean flag to set the initial distance values of the vertices. If set to true, it will initialize the distances as INF, and -1 otherwise.
      maxDepth - maximum depth limit for the BFS traversal.
      distance - (out argument) vertex property holding the hop distance for each reachable vertex in the graph.
      parent - (out argument) vertex property holding the parent vertex of the each reachable vertex in the path.
      Returns:
      Pair holding first a node property with the hop distance for each reachable node in the graph and a second node property with the parent node of each reachable node in the path.

      Examples

       
       PgxGraph graph = ...;
       PgxVertex<Integer> vertex = graph.getVertex(128);
       VertexFilter navigator = VertexFilter.ALL;
       VertexProperty<Integer, Integer> distance = graph.createVertexProperty(PropertyType.INTEGER);
       VertexProperty<Integer, PgxVertex<Integer>> parent = graph.createVertexProperty(PropertyType.VERTEX);
       Pair<VertexProperty<Integer, Integer>, VertexProperty<Integer, PgxVertex<Integer>>> dfs =
         analyst.filteredDfs(graph, vertex, navigator, true, distance, parent);
       PgqlResultSet rs = graph.queryPgql(
         "SELECT x, x." + dfs.getFirst().getName() + ", x." + dfs.getSecond().getName() + " MATCH (x) ORDER BY x." +
         dfs.getFirst().getName() + " DESC");
       rs.print();
       
       
      Throws:
      ExecutionException
      InterruptedException
      Since:
      20.1.0
      See Also:
    • computeHighDegreeVertices

      public <ID> Pair<PgxMap<Integer,PgxVertex<ID>>,VertexSet<ID>> computeHighDegreeVertices(PgxGraph graph, int k, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices) throws ExecutionException, InterruptedException

      Computes the k vertices with the highest degrees in the graph.

      Definition

      Computes the k vertices with the highest degrees in the graph. The resulting map will contain a mapping with the sorted index to the high-degree vertex with the index.

      Implementation Details

      null

      Complexity

      • Time: O(N log N) with N = number of vertices
      • Space: O(k) with V = number of vertices

      Default Values

      Applications

      • Can be used to compute the vertices with the highest degrees a.k.a. super-vertices. This information can be useful in certain applications.
      Parameters:
      graph - the graph.
      k - number of high-degree vertices to be computed.
      highDegreeVertexMapping - (out argument) the high-degree vertices.
      highDegreeVertices - (out argument) the high-degree vertices.
      Returns:
      Pair holding first a map with the top k high-degree vertices and their indices and a second vertex set containing the same vertices.
      Throws:
      ExecutionException
      InterruptedException
    • computeHighDegreeVertices

      public <ID> Pair<PgxMap<Integer,PgxVertex<ID>>,VertexSet<ID>> computeHighDegreeVertices(PgxGraph graph, int k) throws ExecutionException, InterruptedException

      Computes the k vertices with the highest degrees in the graph.

      Definition

      Computes the k vertices with the highest degrees in the graph. The resulting map will contain a mapping with the sorted index to the high-degree vertex with the index.

      Implementation Details

      null

      Complexity

      • Time: O(N log N) with N = number of vertices
      • Space: O(k) with V = number of vertices

      Default Values

      Applications

      • Can be used to compute the vertices with the highest degrees a.k.a. super-vertices. This information can be useful in certain applications.
      Parameters:
      graph - the graph.
      k - number of high-degree vertices to be computed.
      Returns:
      Pair holding first a map with the top k high-degree vertices and their indices and a second vertex set containing the same vertices.
      Throws:
      ExecutionException
      InterruptedException
    • createDistanceIndex

      public <ID> VertexProperty<ID,PgxVect<Integer>> createDistanceIndex(PgxGraph graph, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices) throws ExecutionException, InterruptedException

      Computes an index with distances to each high-degree vertex.

      Definition

      Computes an index which contains the distance to the given high-degree vertices for every node in the graph.

      Implementation Details

      null

      Complexity

      • Time: O(E * k) with E = number of edges, k <= number of high-degree vertices
      • Space: O(V * k) with V = number of vertices

      Default Values

      Applications

      • The index can be used to speed up certain path-finding algorithms.
      Parameters:
      graph - the graph.
      highDegreeVertexMapping - map containing the high-degree vertices as values and indices from 0 to k as keys.
      highDegreeVertices - a set containing the high-degree vertices.
      Returns:
      A vertex-integer-vector property containing the distances from each high-degree vertex for each vertex in the graph.
      Throws:
      ExecutionException
      InterruptedException
    • createDistanceIndex

      public <ID> VertexProperty<ID,PgxVect<Integer>> createDistanceIndex(PgxGraph graph, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index) throws ExecutionException, InterruptedException

      Computes an index with distances to each high-degree vertex.

      Definition

      Computes an index which contains the distance to the given high-degree vertices for every node in the graph.

      Implementation Details

      null

      Complexity

      • Time: O(E * k) with E = number of edges, k <= number of high-degree vertices
      • Space: O(V * k) with V = number of vertices

      Default Values

      Applications

      • The index can be used to speed up certain path-finding algorithms.
      Parameters:
      graph - the graph.
      highDegreeVertexMapping - map containing the high-degree vertices as values and indices from 0 to k as keys.
      highDegreeVertices - a set containing the high-degree vertices.
      index - (out-argument) the index containing the distances to each high-degree vertex for all vertices.
      Returns:
      A vertex-integer-vector property containing the distances from each high-degree vertex for each vertex in the graph.
      Throws:
      ExecutionException
      InterruptedException
    • limitedShortestPathHopDist

      public <ID> Pair<VertexSequence<ID>,EdgeSequence> limitedShortestPathHopDist(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index, VertexSequence<ID> pathVertices, EdgeSequence pathEdges) throws ExecutionException, InterruptedException

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      pathVertices - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      pathEdges - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
      Throws:
      ExecutionException
      InterruptedException
    • limitedShortestPathHopDist

      public <ID> Pair<VertexSequence<ID>,EdgeSequence> limitedShortestPathHopDist(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index) throws ExecutionException, InterruptedException

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
      Throws:
      ExecutionException
      InterruptedException
    • limitedShortestPathHopDistFiltered

      public <ID> Pair<VertexSequence<ID>,EdgeSequence> limitedShortestPathHopDistFiltered(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index, EdgeFilter filter, VertexSequence<ID> pathVertices, EdgeSequence pathEdges) throws ExecutionException, InterruptedException

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      filter - filter to be evaluated on the edges when searching for a path.
      pathVertices - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      pathEdges - (out-argument) will contain the vertices on the found path or will be empty if there is none.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
      Throws:
      ExecutionException
      InterruptedException
    • limitedShortestPathHopDistFiltered

      public <ID> Pair<VertexSequence<ID>,EdgeSequence> limitedShortestPathHopDistFiltered(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int maxHops, PgxMap<Integer,PgxVertex<ID>> highDegreeVertexMapping, VertexSet<ID> highDegreeVertices, VertexProperty<ID,PgxVect<Integer>> index, EdgeFilter filter) throws ExecutionException, InterruptedException

      Computes the k-hop limited shortest path between two vertices.

      Definition

      Computes the shortest path between the source and destination vertex. The algorithm only considers paths up to a length of k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      • Path-finding applications where the path should be / can be limited by a certain number of hops.
      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      maxHops - the maximum number of edges to follow when trying to find a path.
      highDegreeVertexMapping - the high-degree vertices.
      highDegreeVertices - the high-degree vertices.
      index - index containing distances to high-degree vertices.
      filter - filter to be evaluated on the edges when searching for a path.
      Returns:
      A pair containing the vertices in the shortest path from src to dst and the edges on the path. Both will be empty if there is no path within maxHops steps.
      Throws:
      ExecutionException
      InterruptedException
    • allReachableVerticesEdges

      public <ID> org.apache.commons.lang3.tuple.Triple<VertexSet<ID>,EdgeSet,PgxMap<PgxVertex<ID>,Integer>> allReachableVerticesEdges(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int k) throws ExecutionException, InterruptedException

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Definition

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      k - the dimension of the distances property; i.e. number of high-degree vertices.
      Returns:
      a Triple containing a vertex-set with the vertices on the path, an edge-set with the edges on the path and a map containing the distances from the source vertex for each vertex on the path
      Throws:
      ExecutionException
      InterruptedException
    • allReachableVerticesEdgesFiltered

      public <ID> org.apache.commons.lang3.tuple.Triple<VertexSet<ID>,EdgeSet,PgxMap<PgxVertex<ID>,Integer>> allReachableVerticesEdgesFiltered(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int k, EdgeFilter filter) throws ExecutionException, InterruptedException

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Definition

      Finds all the vertices and edges on a path between the src and target of length smaller or equal to k.

      Implementation Details

      null

      Complexity

      • Time: O(E) with E = number of edges
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      k - the dimension of the distances property; i.e. number of high-degree vertices.
      filter - the filter to be used on edges when searching for a path.
      Returns:
      a Triple containing a vertex-set with the vertices on the path, an edge-set with the edges on the path and a map containing the distances from the source vertex for each vertex on the path
      Throws:
      ExecutionException
      InterruptedException
    • enumerateSimplePaths

      public <ID> org.apache.commons.lang3.tuple.Triple<ScalarSequence<Integer>,VertexSequence<ID>,EdgeSequence> enumerateSimplePaths(PgxGraph graph, PgxVertex<ID> src, PgxVertex<ID> dst, int k, VertexSet verticesOnPath, EdgeSet edgesOnPath, PgxMap<PgxVertex<ID>,Integer> dist) throws ExecutionException, InterruptedException

      Enumerate all simple paths between the source and destination vertex

      Definition

      Enumerate all simple paths between the source and destination vertex

      Implementation Details

      null

      Complexity

      • Time: O(E * k) with E = number of edges, k <= maximum number of iterations
      • Space: O(V) with V = number of vertices

      Default Values

      Applications

      Parameters:
      graph - the graph.
      src - the source vertex.
      dst - the destination vertex.
      k - the dimension of the distances property; i.e. number of high-degree vertices.
      verticesOnPath - the vertices on the path.
      edgesOnPath - the edges on the path.
      dist - map containing the distance from the source vertex for each vertex on a path.
      Returns:
      a Triple containing a sequence containing the path lengths, a vertex-sequence containing the vertices on the paths and an edge-sequence containing the edges on the paths
      Throws:
      ExecutionException
      InterruptedException
    • randomWalkWithRestart

      public <ID> PgxMap<PgxVertex<ID>,Integer> randomWalkWithRestart(PgxGraph graph, ID source, int length, BigDecimal resetProb, PgxMap<PgxVertex<ID>,Integer> visitCount) throws ExecutionException, InterruptedException
      Convenience wrapper around randomWalkWithRestart(PgxGraph, PgxVertex, int, double, PgxMap) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • matrixFactorizationRecommendations

      public <ID> VertexProperty<ID,Double> matrixFactorizationRecommendations(BipartiteGraph graph, ID user, int vectorLength, VertexProperty<ID,PgxVect<Double>> feature, VertexProperty<ID,Double> estimatedRating) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max) throws ExecutionException, InterruptedException
      Convenience wrapper around {@link #personalizedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int,)} taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max, boolean norm) throws ExecutionException, InterruptedException
      Convenience wrapper around personalizedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int, boolean) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException
      Convenience wrapper around #personalizedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int, VertexProperty<ID, Double>) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedPagerank

      public <ID> VertexProperty<ID,Double> personalizedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max, boolean norm, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException
      Convenience wrapper around #personalizedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int, boolean, VertexProperty<ID, Double>) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException
      Convenience wrapper around personalizedWeightedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int, EdgeProperty) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max, boolean norm, EdgeProperty<Double> weight) throws ExecutionException, InterruptedException
      Convenience wrapper around personalizedWeightedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int, boolean, EdgeProperty) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException
      Convenience wrapper around #personalizedWeightedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int, EdgeProperty, VertexProperty<ID, Double>) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedWeightedPagerank

      public <ID> VertexProperty<ID,Double> personalizedWeightedPagerank(PgxGraph graph, ID vertexId, BigDecimal e, BigDecimal d, int max, boolean norm, EdgeProperty<Double> weight, VertexProperty<ID,Double> rank) throws ExecutionException, InterruptedException
      Convenience wrapper around #personalizedWeightedPagerank(PgxGraph, PgxVertex, BigDecimal, BigDecimal, int, boolean, EdgeProperty, VertexProperty<ID, Double>) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, ID vertexId, int topK) throws ExecutionException, InterruptedException
      Convenience wrapper around whomToFollow(PgxGraph, PgxVertex, int) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, ID vertexId, int topK, int sizeCircleOfTrust) throws ExecutionException, InterruptedException
      Convenience wrapper around whomToFollow(PgxGraph, PgxVertex, int, int) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, ID vertexId, int topK, int sizeCircleOfTrust, int maxIter, BigDecimal tol, BigDecimal dampingFactor, int salsaMaxIter, BigDecimal salsaTol) throws ExecutionException, InterruptedException
      Convenience wrapper around whomToFollow(PgxGraph, PgxVertex, int, int, int, BigDecimal, BigDecimal, int, BigDecimal) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • whomToFollow

      public <ID> Pair<VertexSequence<ID>,VertexSequence<ID>> whomToFollow(PgxGraph graph, ID vertexId, int topK, int sizeCircleOfTrust, int maxIter, BigDecimal tol, BigDecimal dampingFactor, int salsaMaxIter, BigDecimal salsaTol, VertexSequence<ID> hubs, VertexSequence<ID> authorities) throws ExecutionException, InterruptedException
      Convenience wrapper around whomToFollow(PgxGraph, PgxVertex, int, int, int, BigDecimal, BigDecimal, int, BigDecimal, VertexSequence, VertexSequence) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • fattestPath

      public <ID> AllPaths<ID> fattestPath(PgxGraph graph, ID rootId, EdgeProperty<Double> capacity) throws ExecutionException, InterruptedException
      Convenience wrapper around fattestPath(PgxGraph, PgxVertex, EdgeProperty) taking a vertex ID instead of a PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • fattestPath

      public <ID> AllPaths<ID> fattestPath(PgxGraph graph, ID rootId, EdgeProperty<Double> capacity, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstra

      public <ID> PgxPath<ID> shortestPathDijkstra(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException
      Convenience wrapper around shortestPathDijkstra(PgxGraph, PgxVertex, PgxVertex, EdgeProperty) taking vertex IDs instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstra

      public <ID> PgxPath<ID> shortestPathDijkstra(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Convenience wrapper around shortestPathDijkstra(PgxGraph, PgxVertex, PgxVertex, EdgeProperty) taking vertex IDs instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstra

      public <ID> PgxPath<ID> shortestPathFilteredDijkstra(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost, GraphFilter filterExpr) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstra

      public <ID> PgxPath<ID> shortestPathFilteredDijkstra(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathDijkstraBidirectional(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathDijkstraBidirectional(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathFilteredDijkstraBidirectional(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost, GraphFilter filterExpr) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathFilteredDijkstraBidirectional

      public <ID> PgxPath<ID> shortestPathFilteredDijkstraBidirectional(PgxGraph graph, ID srcId, ID dstId, EdgeProperty<Double> cost, GraphFilter filterExpr, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFord

      public <ID> AllPaths<ID> shortestPathBellmanFord(PgxGraph graph, ID srcId, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFord

      public <ID> AllPaths<ID> shortestPathBellmanFord(PgxGraph graph, ID srcId, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException
      Convenience wrapper around shortestPathBellmanFord(PgxGraph, PgxVertex, EdgeProperty) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFordReverse

      public <ID> AllPaths<ID> shortestPathBellmanFordReverse(PgxGraph graph, ID srcId, EdgeProperty<Double> cost) throws ExecutionException, InterruptedException
      Convenience wrapper around shortestPathBellmanFordReverse(PgxGraph, PgxVertex, EdgeProperty) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathBellmanFordReverse

      public <ID> AllPaths<ID> shortestPathBellmanFordReverse(PgxGraph graph, ID srcId, EdgeProperty<Double> cost, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDist

      public <ID> AllPaths<ID> shortestPathHopDist(PgxGraph graph, ID srcId) throws ExecutionException, InterruptedException
      Convenience wrapper around shortestPathHopDist(PgxGraph, PgxVertex) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDist

      public <ID> AllPaths<ID> shortestPathHopDist(PgxGraph graph, ID srcId, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDistReverse

      public <ID> AllPaths<ID> shortestPathHopDistReverse(PgxGraph graph, ID srcId) throws ExecutionException, InterruptedException
      Convenience wrapper around shortestPathHopDistReverse(PgxGraph, PgxVertex) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • shortestPathHopDistReverse

      public <ID> AllPaths<ID> shortestPathHopDistReverse(PgxGraph graph, ID srcId, VertexProperty<ID,Double> distance, VertexProperty<ID,PgxVertex<ID>> parent, VertexProperty<ID,PgxEdge> parentEdge) throws ExecutionException, InterruptedException
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, ID v, BigDecimal d, int maxIterations, BigDecimal maxDiff) throws ExecutionException, InterruptedException
      Convenience wrapper around personalizedSalsa(BipartiteGraph, PgxVertex, BigDecimal, int, BigDecimal) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • personalizedSalsa

      public <ID> VertexProperty<ID,Double> personalizedSalsa(BipartiteGraph graph, ID v, BigDecimal d, int maxIterations, BigDecimal maxDiff, VertexProperty<ID,Double> salsaRank) throws ExecutionException, InterruptedException
      Convenience wrapper around #personalizedSalsa(BipartiteGraph, PgxVertex, BigDecimal, int, BigDecimal, VertexProperty<ID, Double>) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • prim

      Convenience wrapper around prim(PgxGraph, EdgeProperty, String)
      Throws:
      ExecutionException
      InterruptedException
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, ID root) throws ExecutionException, InterruptedException
      Convenience wrapper around filteredBfs(PgxGraph, PgxVertex) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • filteredBfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredBfs(PgxGraph graph, ID root, int maxDepth) throws ExecutionException, InterruptedException
      Convenience wrapper around filteredBfs(PgxGraph, PgxVertex, int) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, ID root) throws ExecutionException, InterruptedException
      Convenience wrapper around filteredDfs(PgxGraph, PgxVertex) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException
    • filteredDfs

      public <ID> Pair<VertexProperty<ID,Integer>,VertexProperty<ID,PgxVertex<ID>>> filteredDfs(PgxGraph graph, ID root, int maxDepth) throws ExecutionException, InterruptedException
      Convenience wrapper around filteredDfs(PgxGraph, PgxVertex, int) taking a vertex ID instead of PgxVertex.
      Throws:
      ExecutionException
      InterruptedException