Project: GraphScope (App Definition and Development / Database)
File: builtin_algorithms.md

The graph analytical engine (GAE) of GraphScope offers many built-in algorithms, which enable users to analyze their graph data with least effort. The built-in algorithms covers a wide range of applications, such as the shortest path, community detection, clustering, etc. The built-in algorithms are implemented with the and highly optimized for the best performance, and users can use them in the out-of-box manner. Here is the full list of supported built-in algorithms: This algorithm is used to find all pair shortest path problem from a given weighted graph. As a result of this algorithm, it will compute the minimum distance from any vertex to all other vertices in the graph. ```{py:function} allpairsshortestpathlength() Compute the shortest path lengths between all vertices in the graph. ``` Assortativity in a graph refers to the tendency of vertices to connect with other similar vertices over dissimilar vertices. Attribute assortativity is a measure of the extent to which vertices with the same properties connect to each other. ```{py:function} attribute_assortativity() Compute assortativity for vertex attributes. ``` The average degree connectivity is the average nearest neighbor degree of vertices with degree k. This algorithm returns a list of k-average degree connectivity for a graph for successive k=0,1,2. ```{py:function} averagedegreeconnectivity(sourcedegreetype, targetdegreetype) Compute the average degree connectivity of the graph. :param sourcedegreetype: use in-,out- or in+out-degree for source vertex :type sourcedegreetype: str :param targetdegreetype: use in-,out- or in+out-degree for target vertex :type targetdegreetype: str ``` Betweenness centrality is a measure of centrality in a graph based on shortest paths. Betweenness centrality of a vertex v is the sum of the fraction of all-pairs shortest paths that pass through v. ```{py:function} betweenness_centrality(normalized, endpoints) Compute the shortest-path betweenness centrality for vertices. :param normalized: whether the result should be normalized :type normalized: bool :param endpoints: whether including the endpoints in the shortest path counts :type endpoints: bool ``` Breadth-First Search (BFS) is an algorithm for traversing or searching graph data. It starts at a root vertex and explores all vertices at the present depth prior to moving on to the vertices at the next depth level. ```{py:function} bfs(source) Compute a list of vertices in breadth-first search from source. :param source: The source vertex for breadth-first search :type source: int ``` Evaluate Community Detection with Label Propagation, Also known as LPA. See ```{py:function} cdlp(max_round=10) Evaluate Community Detection with Label Propagation :param max_round: Maximum rounds, default to 10 :type max_round: int ``` The original closeness centrality of a vertex v is the reciprocal of the average shortest path distance to v over all n-1 reachable nodes. Wasserman and Faust proposed an improved formula for graphs with more than one connected component. The result is a ratio of the fraction of actors in the group who are reachable, to the average distance from the reachable actors. ```{py:function} closeness_centrality(wf) Compute closeness centrality for

:param wf: whether the Wasserman and Faust improved formula is used :type wf: bool ``` The clustering algorithm is to compute the clustering coefficient for each vertex of a graph. The clustering coefficient of a vertex in a graph quantifies how close its neighbors are to being a clique (complete graph). ```{py:function} clustering() Compute the clustering coefficient for each vertex in the graph. ``` Similar to attribute assortativity, degree assortativity coefficient measures tendency of having an edge (u,v) such that, degree(u) equals to degree(v). ```{py:function} degreeassortativitycoefficient(sourcedegreetype, targetdegreetype, weighted) Compute degree assortativity coefficient of the graph. :param sourcedegreetype: use in-,out- or in+out-degree for source vertex :type sourcedegreetype: str :param targetdegreetype: use in-,out- or in+out-degree for target vertex :type targetdegreetype: str :param weight: The edge attribute that holds the numerical value used as a weight. If `False`, then each edge has weight 1. The degree is the sum of the edge weights adjacent to the vertex. :type weight: bool ``` The degree centrality for a vertex v is the fraction of nodes it is connected to. If the graph is directed, then three separate measures of degree centrality are defined, namely, in-degree, out-degree and both in- and out-degree. ```{py:function} degreecentrality(centralitytype) Compute the degree centrality for vertices. :param centrality_type: `in`, `out` or `both` degree are applied :type centrality_type: str ``` Depth-First-Search (DFS) is an algorithm for traversing or searching graph data. It starts at a root vertex and explores as far as possible along each branch before backtracking. ```{py:function} dfs(source) Compute a list of vertices in depth-first search from source. :param source: The source vertex for depth-first search :type source: int ``` Eigenvector centrality is a measure of the influence of a vertex in a graph. Relationships originating from high-scoring vertices contribute more to the score of a vertex than connections from low-scoring vertices. A high eigenvector score means that a vertex is connected to many vertices who themselves have high scores. ```{py:function} eigenvectorcentrality(tolerance, maxround) Compute the eigenvector centrality for the graph. :param tolerance: error tolerance used to check convergence :type tolerance: double :param max_round: maximum number of iterations :type max_round: int ``` Hyperlink-Induced Topic Search (HITS) is an iterative algorithm to compute the importance of each vertices in a graph. It rates vertices based on two scores, a hub score and an authority score. The authority score estimates the importance of the vertex within the graph. The hub score estimates the value of its relationships to other vertices. ```{py:function} hits(tolerance, max_round, normalized) Compute the HITS value for each vertex in the graph. :param tolerance: error tolerance used to check convergence :type tolerance: double :param max_round: maximum number of iterations :type max_round: int :param normalized: whether we need to normalize the resulting values :type normalized: bool ``` computes the relative influence of a vertex within a graph by measuring the number of the immediate neighbors (first degree vertices) and also all other vertices in the graph that connect to the vertex under consideration through these immediate neighbors. ```{py:function} katzcentrality(alpha, beta, tolerance, maxround, normalized) Compute the Katz centrality for the vertices of the

:param alpha: attenuation factor :type alpha: double :param beta: weight attributed to the immediate neighborhood :type beta: double :param tolerance: error tolerance used to check convergence :type tolerance: double :param max_round: maximum number of iterations :type max_round: int :param normalized: whether we need to normalize the resulting values :type normalized: bool ``` This algorithm is to find a k-core from an original graph, and a k-core is a maximal subgraph that contains vertices of degree k or more. The k-core is found by recursively pruning vertices with degrees less than k. ```{py:function} kkore(k) Compute the k-core of the graph. :param k: The order of the core :type k: int ``` The k-shell is the subgraph induced by vertices with core number k. That is, vertices in the k-core that are not in the (k+1)-core. ```{py:function} kshell(k) Compute the k-shell of the graph. :param k: The order of the shell :type k: int ``` The Label Propagation Algorithm (LPA) is a fast algorithm for finding communities in a graph. It is an iterative algorithm where we assign labels to unlabelled vertices by propagating labels through the graph. ```{py:function} lpa(max_round) Compute the label of each vertex in the graph. :param max_round: the number of iterations during the computation :type max_round: int ``` The LCC is aims to compute the local clustering coefficient, follow the specification of LDBC ```{py:function} lcc() Compute the local clustering coefficient for each vertex in the graph. ``` PageRank is a way of measuring the importance of each vertices in a graph. The PageRank algorithm exists in many variants, the PageRank in GAE follows . ```{py:function} pagerank(alpha, max_round, tolerance) Compute the PageRank value for each vertex in the graph. :param alpha: damping parameter for PageRank :type alpha: double :param max_round: maximum number of iterations :type max_round: int :param tolerance: error tolerance used to check convergence :type tolerance: double ``` This algorithm samples a set of paths starting from a root vertex with path length. ```{py:function} samplingpath(sourceid, cutoff) Compute a set of paths starting from a root vertex. :param source_id: the source vertex of path sampling :type source_id: int :param cutoff: maximum length of paths :type cutoff: int ``` The Single-Source Shortest Paths (SSSP) fixes a single vertex as the "source" vertex and finds shortest paths from the source to all other vertices in the graph. ```{py:function} sssp(source) Compute shortest paths from a source vertex in the graph. :param source: The source vertex for the shortest paths :type source: int ``` VoteRank is to measure a ranking of the vertices in a graph based on a voting scheme. With VoteRank, all vertices vote for each of its in-neighbors and the vertices with the top highest votes is elected iteratively. ```{py:function} voterank(numofnodes) Select a list of influential vertices in a graph using VoteRank algorithm. :param numofnodes: the number of ranked vertices to extract :type numofnodes: int ``` Compute the weakly connected component ```{py:function} wcc() Compute the weakly connected component in the graph. ```