A class represents an app asset node in a DAG that holds the bytes of the gar resource.
Assets includes an algorithm name, and gar (for user defined algorithm),
a context type (one of ‘tensor’, ‘vertex_data’, ‘vertex_property’,
‘labeled_vertex_data’, ‘dynamic_vertex_data’, ‘labeled_vertex_property’),
and its type (one of cpp_pie, cpp_pregel, cython_pie, cython_pregel),
A class represents a java app assert node in a DAG that holds the jar file.
It holds neccessary resouces to run a java app, including java class path, the gar
file which consists jar and configuration yaml, and the specified java class.
On creating a JavaApp, graphscope will try to load the specified java class, and parse
the Base class for your app, and the base class for your Context Class. This operation
requires a java runtime environment installed in your client machine where your graphscope
session is created.
To run your app, provide JavaApp with a property or projected graph and your querying args.
An application that can run on graphs and produce results.
Analytical engine will build the app dynamic library when instantiate a app instance.
And the dynamic library will be reused if subsequent app’s signature matches one of
previous ones.
Assortativity measures the similarity of connections in the graph with
respect to the given attribute.
Parameters:
graph (graphscope.Graph) – A simple graph.
attribute (str) – Node attribute key.
Returns:
Assortativity of graph for given attribute
Return type:
r (float)
Notes
This computes Eq. (2) in Ref. [1]_ , (trace(M)-sum(M^2))/(1-sum(M^2)),
where M is the joint probability distribution (mixing matrix)
of the specified attribute.
References
[1] M. E. J. Newman, Mixing patterns in networks, Physical Review E, 67 026126, 2003
The average degree connectivity is the average nearest neighbor degree of
nodes with degree k. For weighted graphs, an analogous measure can
be computed using the weighted average neighbors degree defined in
[1]_, for a node i, as
\[k_{nn,i}^{w} =\]
rac{1}{s_i} sum_{j in N(i)} w_{ij} k_j
where s_i is the weighted degree of node i,
w_{ij} is the weight of the edge that links i and j,
and N(i) are the neighbors of node i.
graph : (graphscope.Graph): A simple graph.
source“in”|”out”|”in+out” (default:”in+out”)
Directed graphs only. Use “in”- or “out”-degree for source node.
target“in”|”out”|”in+out” (default:”in+out”
Directed graphs only. Use “in”- or “out”-degree for target node.
weightstring or None, optional (default=None)
The edge attribute that holds the numerical value used as a weight.
If None, then each edge has weight 1.
ddict
A dictionary keyed by degree k with the value of average connectivity.
ValueError
If either source or target are not one of ‘in’,
‘out’, or ‘in+out’.
where V is the set of nodes in G, d(s, t) is the shortest path from s to t,
and n is the number of nodes in G.
Parameters:
graph ((graphscope.Graph): A simple graph.) –
weight ((str, optional): The edge data key corresponding to the edge weight.) – Note that property under multiple labels should have the consistent index.
Defaults to None.
Breadth first search from the src on projected simple graph.
Parameters:
graph (graphscope.Graph) – A simple graph.
src (optional) – Source vertex of breadth first search. The type should be consistent
with the id type of the graph, that is, it’s int or str depending
on the oid_type is int64_t or string of the graph. Defaults to 0.
Returns:
A context with each vertex with a distance from the source, will be evaluated in eager mode.
Assortativity measures the similarity of connections
in the graph with respect to the node degree.
:param graph (graphscope.Graph):
:type graph (graphscope.Graph): A simple graph.
:param x: The degree type for source node (directed graphs only).
:type x: string (‘in’,’out’)
:param y: The degree type for target node (directed graphs only).
:type y: string (‘in’,’out’)
:param weighted: weighted graph or unweighted graph
:type weighted: bool (True, False)
Returns:
r (float) – Assortativity of graph by degree.
Examples
.. code:: python – >>> import graphscope
>>> from graphscope.dataset import load_modern_graph
>>> sess = graphscope.session(cluster_type=”hosts”, mode=”eager”)
>>> g = load_modern_graph(sess)
>>> g.schema
>>> c = graphscope.degree_assortativity_coefficient(g, weight=”weight”)
>>> sess.close()
Notes
This computes Eq. (21) in Ref. [1]_ , where e is the joint
probability distribution (mixing matrix) of the degrees. If G is
directed than the matrix e is the joint probability of the
user-specified degree type for the source and target.
weight (str, optional) – The edge data key corresponding to the edge weight.
Note that property under multiple labels should have the consistent index.
Defaults to None.
Returns:
A context with each vertex assigned with a gv-centrality, evaluated in eager mode.
Hyperlink-Induced Topic Search (HITS; also known as hubs and authorities)
is a link analysis algorithm that rates Web pages. See more here:
https://en.wikipedia.org/wiki/HITS_algorithm
Parameters:
graph (graphscope.Graph) – A simple graph.
tolerance (float, optional) – Defaults to 0.01.
max_round (int, optional) – Defaults to 100.
normalized (bool, optional) – Whether to normalize the result to 0-1. Defaults to True.
Returns:
A context with each vertex assigned with the HITS value, evaluated in eager mode.
Returns True if and only if nodes form a simple path in G.
A simple path in a graph is a nonempty sequence of nodes in which
no node appears more than once in the sequence, and each adjacent
pair of nodes in the sequence is adjacent in the graph.
:param graph (graphscope.Graph):
:type graph (graphscope.Graph): A simple graph.
:param nodes: A list of one or more nodes in the graph G.
:type nodes: list
Returns:
Whether the given list of nodes represents a simple path in G.
Return type:
bool
Notes
An empty list of nodes is not a path but a list of one node is a
path. Here’s an explanation why.
This function operates on node paths. One could also consider
edge paths. There is a bijection between node paths and edge
paths.
The length of a path is the number of edges in the path, so a list
of nodes of length n corresponds to a path of length n - 1.
Thus the smallest edge path would be a list of zero edges, the empty
path. This corresponds to a list of one node.
To convert between a node path and an edge path, you can use code
like the following:
graph (graphscope.Graph) – A simple undirected graph.
min_progress – The minimum delta X required to be considered progress, where X is the number of nodes
that have changed their community on a particular pass.
Delta X is then the difference in number of nodes that changed communities
on the current pass compared to the previous pass.
progress_tries – number of times the min_progress setting is not met
before exiting form the current level and compressing the graph.
Returns:
A context with each vertex assigned with id of community it belongs to, evaluated in eager mode.
Compute single source shortest path length on the graph.
Note that the sssp algorithm requires an numerical property on the edge.
Parameters:
graph (graphscope.Graph) – A simple graph.
src (optional) – The source vertex. The type should be consistent
with the id type of the graph, that is, it’s int or str depending
on the oid_type is int64_t or string of the graph. Defaults to 0.
weight (str, optional) – The edge data key corresponding to the edge weight.
Note that property under multiple labels should have the consistent index.
Defaults to None.
Returns:
A context with each vertex assigned with the shortest distance from the src,
evaluated in eager mode.
Evaluate weakly connected components on the graph.
This is an optimized version of WCC.
Note this cannot be compiled against a property graph that has multiple labels.
Parameters:
graph (graphscope.Graph) – A simple graph.
Returns:
A context with each vertex assigned with the component ID, evaluated in eager mode.