Cython SDK API

Pregel

Vertex[VD_TYPE, MD_TYPE]

Class which holds vertex id, data and edges.

VD_TYPE: vertex data type MD_TYPE: message type

Vertex.id()str

Get vertex id.

Vertex.label()str

Get vertex label.

Vertex.label_id()int

Get vertex label id.

Vertex.properties()vector[pair[str, str]]

Get list of vertex properties, which consisting of property name and property type. Note that property type is one of (“INT”, “DOUBLE”, “STRING”)

Vertex.set_value(value: VD_TYPE)

Set the vertex data, immediately visible in current round.

Vertex.value()VD_TYPE

Get the vertex value, which data stored with vertex.

Vertex.get_str(property_id: int)str

Get vertex str data by property id.

Vertex.get_str(property_name: str)str

Get vertex str data by property name.

Vertex.get_double(property_id: int)double

Get vertex str data by property id.

Vertex.get_double(property_name: str)double

Get vertex double data by property_name.

Vertex.get_int(property_id: int)str

Get vertex int data by property id.

Vertex.get_int(property_name: str)str

Get vertex int data by property_name.

Vertex.outgoing_edges(edge_label_id: int)AdjList[VD_TYPE, MD_TYPE]

Get a iterable of outgoing edges by edge label id of this vertex.

Vertex.outgoing_edges(edge_label_name: str)AdjList[VD_TYPE, MD_TYPE]

Get a iterable of outgoing edges by edge label name of this vertex.

Vertex.incoming_edges(edge_label_id: int)AdjList[VD_TYPE, MD_TYPE]

Get a iterable of incoming edges by edge label id of this vertex.

Vertex.incoming_edges(edge_label_name: str)AdjList[VD_TYPE, MD_TYPE]

Get a iterable of incoming edges by edge label name of this vertex.

Vertex.send(v: Vertex[VD_TYPE, MD_TYPE], msg: MD_TYPE)

Send a message to target vertex.

Vertex.vote_to_halt()

After this method is called, the compute() code will no longer called with this vertex util receive messages. The application will finish only when all vertices vote to halt.

Neighbor[VD_TYPE, MD_TYPE]
Neighbor.vertex()Vertex[VD_TYPE, MD_TYPE]

Get neighbor vertex.

Neighbor.get_str(column: int)str

Get edge str data by column id.

Neighbor.get_int(column: int)str

Get edge int data by column id.

Neighbor.get_double(column: int)str

Get edge double data by column id.

AdjList[VD_TYPE, MD_TYPE]
AdjList.begin()Neighbor

Return begin addr of the iterator.

AdjList.end()Neighbor

Return end addr of the iterator.

AdjList.size()size_t

Get the size of adj list.

Context[VD_TYPE, MD_TYPE]

Class which holds current step, aggregator info, query args and other util function.

Context.get_config(key: str)str

Get a value with specific key, or “” with key not exist.

Context.register_aggregator(name: str, type: PregelAggregatorType)

Register a aggregator with specific type, naming by name.

Context.aggregate[AGGR_TYPE](name: str, value: AGGR_TYPE)

Add a new value to aggregator.

Context.get_aggregated_value[AGGR_TYPE](name: str) -> AGGR_TYPE

Get value from a aggregator.

Context.superstep()str

Get current superstep, begin with 0.

Context.get_total_vertices_num()size_t

Get total vertex number.

Context.vertex_label_num()int

Get vertex label number.

Context.edge_label_num()int

Get edge label number.

Context.vertex_property_num(vertex_label_name: str)int

Get vertex property number by vertex label name.

Context.vertex_property_num(vertex_label_id: int)int

Get vertex property number by vertex label id.

Context.edge_property_num(edge_label_name: str)int

Get edge property number by edge label name.

Context.edge_property_num(edge_label_id: int)int

Get vertex property number by edge label id.

Context.vertex_labels()vector[str]

Get list of vertex label.

Context.edge_labels()vector[str]

Get list of edge label.

Context.get_vertex_label_by_id(vertex_label_id: int)str

Get vertex label name by label id.

Context.get_vertex_label_id_by_name(vertex_label_name: str)int

Get vertex label id by name.

Context.get_edge_label_by_id(edge_label_id: int)str

Get edge label name by label id.

Context.get_edge_label_id_by_name(edge_label_name: str)int

Get edge label id by name.

Context.vertex_properties(vertex_label_id: int)vector[pair[str, str]]

Get list of vertex properties by label id.

Context.vertex_properties(vertex_label_name: str)vector[pair[str, str]]

Get list of vertex properties by label name.

Context.edge_properties(edge_label_id: int)vector[pair[str, str]]

Get list of edge properties by label id.

Context.edge_properties(edge_label_name: str)vector[pair[str, str]]

Get list of edge properties by label name.

Context.get_vertex_property_id_by_name(vertex_label_name: str, vertex_property_name: str)int

Get vertex property id by property name.

Context.get_vertex_property_id_by_name(vertex_label_id: int, vertex_property_name: str)int

Get vertex property id by property name.

Context.get_vertex_property_by_id(vertex_label_name: str, vertex_property_id: int)str

Get vertex property name by property id.

Context.get_vertex_property_by_id(vertex_label_id: int, vertex_property_id: int)int

Get vertex property name by property id.

Context.get_edge_property_id_by_name(edge_label_name: str, edge_property_name: str)int

Get edge property id by property name.

Context.get_edge_property_id_by_name(edge_label_id: int, edge_property_name: str)int

Get edge property id by property name.

Context.get_edge_property_by_id(edge_label_name: str, edge_property_id: int)str

Get edge property name by property id.

Context.get_edge_property_by_id(edge_label_id: int, edge_property_id: int)int

Get edge property name by property id.

MessageIterator[MD_TYPE]
MessageIterator.empty()bool

Return True if there is no message in queue.

class graphscope.analytical.app.pregel.PregelAggregatorType
kBoolAndAggregator

Aggregator for calculating the AND function over boolean values. The default value when nothing is aggregated is true.

kBoolOrAggregator

Aggregator for calculating the OR function over boolean values. The default value when nothing is aggregated is false.

kBoolOverwriteAggregator

Aggregator that stores a value that is overwritten once another value is aggregated. Note that, in case multiple vertices write to this aggregator, the behavior is non-deterministic. The default value for this aggregator is false.

kDoubleMinAggregator

Aggregator for getting min double value.

kDoubleMaxAggregator

Aggregator for getting max double value.

kDoubleSumAggregator

Aggregator for summing up double values.

kDoubleProductAggregator

Aggregator for calculating products of double value.

kDoubleOverwriteAggregator

Aggregator that stores a value that is overwritten once another value is aggregated. Note that, in case multiple vertices write to this aggregator, the behavior is non-deterministic.

kInt64MinAggregator

Aggregator for getting min int64 value.

kInt64MaxAggregator

Aggregator for getting max int64 value.

kInt64SumAggregator

Aggregator for summing up int64 values.

kInt64ProductAggregator

Aggregator for calculating products of int64 value.

kInt64OverwriteAggregator

Aggregator that stores a value that is overwritten once another value is aggregated. Note that, in case multiple vertices write to this aggregator, the behavior is non-deterministic.

kTextAppendAggregator

Aggregator with string as its value which keeps appending text to it.

PIE

class graphscope.analytical.app.pie.MessageStrategy
kAlongOutgoingEdgeToOuterVertex

For each of inner vertex, it will send messages to target vertex along outgoing edges.

kAlongIncomingEdgeToOuterVertex

For each of inner vertex, it will send messages to target vertex along incoming edges.

kAlongEdgeToOuterVertex

For each of inner vertex, it will send messages to target vertex along both incoming and outgoing edges.

kSyncOnOuterVertex

For each of outer vertex, it will send messages to fragment which it belongs to (sync message to itself).

class graphscope.analytical.app.pie.Vertex
Vertex()

Vertex in graph.

class graphscope.analytical.app.pie.VertexRange
VertexRange()

A range list of vertex, which only contain vertex id.

begin()Vertex

The begin addr of vertex range list.

end()Vertex

The end addr of vertex range list.

size()int

The size of vertex range list.

VertexArray[T]
VertexArray.VertexArray()

A list of vertex, which also contain a vertex data.

VertexArray.Init(range: VertexRange)

Init VertexArray with default value.

VertexArray.Init(range: VertexRange, const T& value)

Init VertexArray with specify value.

VertexArray.operator[](v: Vertex) -> T

Get vertex data.

class graphscope.analytical.app.pie.Nbr
Nbr()
neighbor()Vertex

Get nerghbor vertex.

get_str(column: int)str

Get edge str data by column id.

get_int(column: int)str

Get edge int data by column id.

get_double(column: int)str

Get edge double data by column id.

class graphscope.analytical.app.pie.AdjList
AdjList()
end()Nbr

Return end addr of the adj list.

size()int

Get the size of adj list.

class graphscope.analytical.app.pie.Fragment
Fragment()
fid()int

Get fragment id.

fnum()int

Get fragment number.

vertex_label_num()int

Get vertex label number.

edge_label_num()int

Get edge label number.

get_total_nodes_num()size_t

Get total vertex number.

get_nodes_num(vertex_label_id: int)size_t

Get vertex(inner + outer) number by label id.

get_inner_nodes_num(vertex_label_id: int)size_t

Get inner vertex number by label id.

get_outer_nodes_num(vertex_label_id: int)size_t

Get outer vertex number by label id.

nodes(vertex_label_id: int)VertexRange

Get vertex range of this fragment by label id.

inner_nodes(vertex_label_id: int)VertexRange

Get inner vertex range in this fragment by label id.

outer_nodes(vertex_label_id: int)VertexRange

Get outer vertex range in this fragment by label id.

get_node_fid(v: Vertex)int

Get fragment id of the v.

is_inner_node(v: Vertex)bool

Return True if v is the inner vertex of this fragment.

is_outer_node(v: Vertex)bool

Return False if v is the outer vertex of this fragment.

get_node(label_id: int, oid: int64_t, v: Vertex&)bool

Return True if oid exists in this fragment.

get_inner_node(label_id: int, oid: int64_t, v: Vertex&)bool

Return True if oid exists in the inner vertex in this fragment, and assign the node to v.

get_outer_node(label_id: int, oid: int64_t, v: Vertex&)bool

Return True if oid exists in the outer vertex in this fragment, and assign the node to v.

get_node_id(v: Vertex)int64_t

Return vertex oid of v.

get_outgoing_edges(v: Vertex, edge_label_id: int)AdjList

Get a iterable of outgoing edges by label id of this vertex.

get_incoming_edges(v: Vertex, edge_label_id: int)AdjList

Get a iterable of incoming edges by label id of this vertex.

has_child(v: Vertex, edge_label_id: int)bool

Return True of vertex has child with connection of edge label id.

has_parent(v: Vertex, edge_label_id: int)bool

Return True of vertex has parent with connection of edge label id.

get_indegree(v: Vertex, edge_label_id: int)bool

Return the in-degree of edge with specified edge id.

get_outdegree(v: Vertex, edge_label_id: int)bool

Return the out-degree of edge with specified edge id.

get_str(v: Vertex, vertex_property_id: int)str

Get vertex str data by property id.

get_int(v: Vertex, vertex_property_id: int)int

Get vertex int data by property id.

get_double(v: Vertex, vertex_property_id: int)double

Get vertex double data by property id.

vertex_labels()vector[str]

Get list of vertex label.

edge_labels()vector[str]

Get list of edge label.

get_vertex_label_by_id(vertex_label_id: int)str

Get vertex label name by label id.

get_vertex_label_id_by_name(vertex_label_name: str)int

Get vertex label id by name.

get_edge_label_by_id(edge_label_id: int)str

Get edge label name by label id.

get_edge_label_id_by_name(edge_label_name: str)int

Get edge label id by name.

vertex_properties(vertex_label_id: int)vector[pair[str, str]]

Get list of vertex properties by label id.

vertex_properties(vertex_label_name: str)vector[pair[str, str]]

Get list of vertex properties by label name.

edge_properties(edge_label_id: int)vector[pair[str, str]]

Get list of edge properties by label id.

edge_properties(edge_label_name: str)vector[pair[str, str]]

Get list of edge properties by label name.

get_vertex_property_id_by_name(vertex_label_name: str, vertex_property_name: str)int

Get vertex property id by property name.

get_vertex_property_id_by_name(vertex_label_id: int, vertex_property_name: str)int

Get vertex property id by property name.

get_vertex_property_by_id(vertex_label_name: str, vertex_property_id: int)str

Get vertex property name by property id.

get_vertex_property_by_id(vertex_label_id: int, vertex_property_id: int)int

Get vertex property name by property id.

get_edge_property_id_by_name(edge_label_name: str, edge_property_name: str)int

Get edge property id by property name.

get_edge_property_id_by_name(edge_label_id: int, edge_property_name: str)int

Get edge property id by property name.

get_edge_property_by_id(edge_label_name: str, edge_property_id: int)str

Get edge property name by property id.

get_edge_property_by_id(edge_label_id: int, edge_property_id: int)int

Get edge property name by property id.

Context[VD_TYPE, MD_TYPE]
Context.Context()
Context.superstep()int

Get current superstep.

Context.get_config(key: str)str

Get a value with specific key, or “” with key not exist.

Context.init_value(range: VertexRange, value: MD_TYPE, type: PIEAggregateType)

Init vertex range with value and type aggregator.

Context.register_sync_buffer(v_label_id: int, strategy: MessageStrategy)

Set auto parallel message strategy.

Context.set_node_value(v: Vertex, value: VD_TYPE)

Set the value of vertex.

Context.get_node_value(v: Vertex)VD_TYPE

Get the value of vertex.

class graphscope.analytical.app.pie.PIEAggregateType

After messages auto passing, each inner vertex will aggregate messages it received.

kMinAggregate

Aggregator for getting min value.

kMaxAggregate

Aggregator for getting max value.

kSumAggregate

Aggregator for summing up values.

kProductAggregate

Aggregator for calculating products of values.

kOverwriteAggregate

Aggregator that stores a value that is overwritten once another value is aggregated. Note that, in case multiple vertices write to this aggregator, the behavior is non-deterministic.

kTextAppendAggregate

Aggregator with string as its value which keeps appending text to it.

GraphScope types

graphscope.Vertex

Functions

graphscope.declare(graphscope_type, variable)

Declare a GraphScope data type.