swh.graph.grpc.swhgraph_pb2_grpc module#

Client and server classes corresponding to protobuf-defined services.

class swh.graph.grpc.swhgraph_pb2_grpc.TraversalServiceStub(channel)[source]#

Bases: object

Graph traversal service

Constructor.

Parameters:

channel – A grpc.Channel.

class swh.graph.grpc.swhgraph_pb2_grpc.TraversalServiceServicer[source]#

Bases: object

Graph traversal service

GetNode(request, context)[source]#

GetNode returns a single Node and its properties.

Traverse(request, context)[source]#

Traverse performs a breadth-first graph traversal from a set of source nodes, then streams the nodes it encounters (if they match a given return filter), along with their properties.

FindPathTo(request, context)[source]#

FindPathTo searches for a shortest path between a set of source nodes and a node that matches a specific criteria.

It does so by performing a breadth-first search from the source node, until any node that matches the given criteria is found, then follows back its parents to return a shortest path from the source set to that node.

FindPathBetween(request, context)[source]#

FindPathBetween searches for a shortest path between a set of source nodes and a set of destination nodes.

It does so by performing a bidirectional breadth-first search, i.e., two parallel breadth-first searches, one from the source set (“src-BFS”) and one from the destination set (“dst-BFS”), until both searches find a common node that joins their visited sets. This node is called the “midpoint node”. The path returned is the path src -> … -> midpoint -> … -> dst, which is always a shortest path between src and dst.

The graph direction of both BFS can be configured separately. By default, the dst-BFS will use the graph in the opposite direction than the src-BFS (if direction = FORWARD, by default direction_reverse = BACKWARD, and vice-versa). The default behavior is thus to search for a shortest path between two nodes in a given direction. However, one can also specify FORWARD or BACKWARD for both the src-BFS and the dst-BFS. This will search for a common descendant or a common ancestor between the two sets, respectively. These will be the midpoints of the returned path.

CountNodes(request, context)[source]#

CountNodes does the same as Traverse, but only returns the number of nodes accessed during the traversal.

CountEdges(request, context)[source]#

CountEdges does the same as Traverse, but only returns the number of edges accessed during the traversal.

Stats(request, context)[source]#

Stats returns various statistics on the overall graph.

swh.graph.grpc.swhgraph_pb2_grpc.add_TraversalServiceServicer_to_server(servicer, server)[source]#
class swh.graph.grpc.swhgraph_pb2_grpc.TraversalService[source]#

Bases: object

Graph traversal service

static GetNode(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]#
static Traverse(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]#
static FindPathTo(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]#
static FindPathBetween(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]#
static CountNodes(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]#
static CountEdges(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]#
static Stats(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]#