snapchat.research.gbml.graph_schema_pb2#

@generated by mypy-protobuf. Do not edit manually! isort:skip_file

Attributes#

Classes#

Edge

Abstract base class for protocol messages.

EdgeType

Abstract base class for protocol messages.

Graph

Represents a graph; usually used to represent a rooted k-hop subgraph for a bigger graph

GraphMetadata

Stores metadata that helps map the created graph samples back to original graph

Node

Abstract base class for protocol messages.

Module Contents#

class snapchat.research.gbml.graph_schema_pb2.Edge(*, src_node_id=..., dst_node_id=..., condensed_edge_type=..., feature_values=...)[source]#

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

Parameters:
  • src_node_id (int)

  • dst_node_id (int)

  • condensed_edge_type (int | None)

  • feature_values (collections.abc.Iterable[float] | None)

ClearField(field_name)[source]#

Clears the contents of a given field.

Inside a oneof group, clears the field set. If the name neither refers to a defined field or oneof group, ValueError is raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Raises:

ValueError – if the field_name is not a member of this message.

Return type:

None

HasField(field_name)[source]#

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

WhichOneof(oneof_group)[source]#

Returns the name of the field that is set inside a oneof group.

If no field is set, returns None.

Parameters:

oneof_group (str) – the name of the oneof group to check.

Returns:

The name of the group that is set, or None.

Return type:

str or None

Raises:

ValueError – no group with the given name exists

CONDENSED_EDGE_TYPE_FIELD_NUMBER: int[source]#
DESCRIPTOR: google.protobuf.descriptor.Descriptor[source]#
DST_NODE_ID_FIELD_NUMBER: int[source]#
FEATURE_VALUES_FIELD_NUMBER: int[source]#
SRC_NODE_ID_FIELD_NUMBER: int[source]#
condensed_edge_type: int[source]#

Graph is assumed homogeneous if condensed_edge_type is not provided We store condensed representation here instead of EdgeType to optimize on storage space. Otherwise we would be storing atleast 3*32bytes of information : (

src_node_type: string, dst_node_type: string, edge_type: string

) See GraphMetadata for mapping

dst_node_id: int[source]#
property feature_values: google.protobuf.internal.containers.RepeatedScalarFieldContainer[float][source]#

features_values for an edge

Return type:

google.protobuf.internal.containers.RepeatedScalarFieldContainer[float]

src_node_id: int[source]#

the src_node_id & dst_node_id that the edge spans across node types for these nodes is encoded in condensed_edge_type

class snapchat.research.gbml.graph_schema_pb2.EdgeType(*, relation=..., src_node_type=..., dst_node_type=...)[source]#

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

Parameters:
  • relation (str)

  • src_node_type (str)

  • dst_node_type (str)

ClearField(field_name)[source]#

Clears the contents of a given field.

Inside a oneof group, clears the field set. If the name neither refers to a defined field or oneof group, ValueError is raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Raises:

ValueError – if the field_name is not a member of this message.

Return type:

None

DESCRIPTOR: google.protobuf.descriptor.Descriptor[source]#
DST_NODE_TYPE_FIELD_NUMBER: int[source]#
RELATION_FIELD_NUMBER: int[source]#
SRC_NODE_TYPE_FIELD_NUMBER: int[source]#
dst_node_type: str[source]#
relation: str[source]#

The relation of source / destination node_type i.e. (Person , is_friend, Person) ; “Person” is node_type for both src and dst nodes, and “is_friend” is the “relation”

src_node_type: str[source]#
class snapchat.research.gbml.graph_schema_pb2.Graph(*, nodes=..., edges=...)[source]#

Bases: google.protobuf.message.Message

Represents a graph; usually used to represent a rooted k-hop subgraph for a bigger graph

Parameters:
  • nodes (collections.abc.Iterable[global___Node] | None)

  • edges (collections.abc.Iterable[global___Edge] | None)

ClearField(field_name)[source]#

Clears the contents of a given field.

Inside a oneof group, clears the field set. If the name neither refers to a defined field or oneof group, ValueError is raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Raises:

ValueError – if the field_name is not a member of this message.

Return type:

None

DESCRIPTOR: google.protobuf.descriptor.Descriptor[source]#
EDGES_FIELD_NUMBER: int[source]#
NODES_FIELD_NUMBER: int[source]#
property edges: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Edge][source]#
Return type:

google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Edge]

property nodes: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Node][source]#
Return type:

google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Node]

class snapchat.research.gbml.graph_schema_pb2.GraphMetadata(*, node_types=..., edge_types=..., condensed_edge_type_map=..., condensed_node_type_map=...)[source]#

Bases: google.protobuf.message.Message

Stores metadata that helps map the created graph samples back to original graph

Parameters:
  • node_types (collections.abc.Iterable[str] | None)

  • edge_types (collections.abc.Iterable[global___EdgeType] | None)

  • condensed_edge_type_map (collections.abc.Mapping[int, global___EdgeType] | None)

  • condensed_node_type_map (collections.abc.Mapping[int, str] | None)

class CondensedEdgeTypeMapEntry(*, key=..., value=...)[source]#

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

Parameters:
  • key (int)

  • value (global___EdgeType | None)

ClearField(field_name)[source]#

Clears the contents of a given field.

Inside a oneof group, clears the field set. If the name neither refers to a defined field or oneof group, ValueError is raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Raises:

ValueError – if the field_name is not a member of this message.

Return type:

None

HasField(field_name)[source]#

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

DESCRIPTOR: google.protobuf.descriptor.Descriptor[source]#
KEY_FIELD_NUMBER: int[source]#
VALUE_FIELD_NUMBER: int[source]#
key: int[source]#
property value: global___EdgeType[source]#
Return type:

global___EdgeType

class CondensedNodeTypeMapEntry(*, key=..., value=...)[source]#

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

Parameters:
  • key (int)

  • value (str)

ClearField(field_name)[source]#

Clears the contents of a given field.

Inside a oneof group, clears the field set. If the name neither refers to a defined field or oneof group, ValueError is raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Raises:

ValueError – if the field_name is not a member of this message.

Return type:

None

DESCRIPTOR: google.protobuf.descriptor.Descriptor[source]#
KEY_FIELD_NUMBER: int[source]#
VALUE_FIELD_NUMBER: int[source]#
key: int[source]#
value: str[source]#
ClearField(field_name)[source]#

Clears the contents of a given field.

Inside a oneof group, clears the field set. If the name neither refers to a defined field or oneof group, ValueError is raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Raises:

ValueError – if the field_name is not a member of this message.

Return type:

None

CONDENSED_EDGE_TYPE_MAP_FIELD_NUMBER: int[source]#
CONDENSED_NODE_TYPE_MAP_FIELD_NUMBER: int[source]#
DESCRIPTOR: google.protobuf.descriptor.Descriptor[source]#
EDGE_TYPES_FIELD_NUMBER: int[source]#
NODE_TYPES_FIELD_NUMBER: int[source]#
property condensed_edge_type_map: google.protobuf.internal.containers.MessageMap[int, global___EdgeType][source]#

EdgeType; 1:1 mapping We use unit32 instead of EdgeType to save space when storing graph information

Type:

Maps condensed_edge_type

Type:

uint32 to edge_type

Return type:

google.protobuf.internal.containers.MessageMap[int, global___EdgeType]

property condensed_node_type_map: google.protobuf.internal.containers.ScalarMap[int, str][source]#

string; 1:1 mapping We use unit32 instead of string to save space when storing graph information

Type:

Maps condensed_node_type

Type:

uint32 to node_type

Return type:

google.protobuf.internal.containers.ScalarMap[int, str]

property edge_types: google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EdgeType][source]#

User provided list of edge types

Return type:

google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EdgeType]

property node_types: google.protobuf.internal.containers.RepeatedScalarFieldContainer[str][source]#

User provided list of node types

Return type:

google.protobuf.internal.containers.RepeatedScalarFieldContainer[str]

class snapchat.research.gbml.graph_schema_pb2.Node(*, node_id=..., condensed_node_type=..., feature_values=...)[source]#

Bases: google.protobuf.message.Message

Abstract base class for protocol messages.

Protocol message classes are almost always generated by the protocol compiler. These generated types subclass Message and implement the methods shown below.

Parameters:
  • node_id (int)

  • condensed_node_type (int | None)

  • feature_values (collections.abc.Iterable[float] | None)

ClearField(field_name)[source]#

Clears the contents of a given field.

Inside a oneof group, clears the field set. If the name neither refers to a defined field or oneof group, ValueError is raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Raises:

ValueError – if the field_name is not a member of this message.

Return type:

None

HasField(field_name)[source]#

Checks if a certain field is set for the message.

For a oneof group, checks if any field inside is set. Note that if the field_name is not defined in the message descriptor, ValueError will be raised.

Parameters:

field_name (str) – The name of the field to check for presence.

Returns:

Whether a value has been set for the named field.

Return type:

bool

Raises:

ValueError – if the field_name is not a member of this message.

WhichOneof(oneof_group)[source]#

Returns the name of the field that is set inside a oneof group.

If no field is set, returns None.

Parameters:

oneof_group (str) – the name of the oneof group to check.

Returns:

The name of the group that is set, or None.

Return type:

str or None

Raises:

ValueError – no group with the given name exists

CONDENSED_NODE_TYPE_FIELD_NUMBER: int[source]#
DESCRIPTOR: google.protobuf.descriptor.Descriptor[source]#
FEATURE_VALUES_FIELD_NUMBER: int[source]#
NODE_ID_FIELD_NUMBER: int[source]#
condensed_node_type: int[source]#

string See GraphMetadata for mapping. If not provided, assumed homogeneous.

Type:

condensed_node_type are integer values that correspond 1

Type:

1 to a node_type

property feature_values: google.protobuf.internal.containers.RepeatedScalarFieldContainer[float][source]#

feature_values for a node

Return type:

google.protobuf.internal.containers.RepeatedScalarFieldContainer[float]

node_id: int[source]#

should be unique for nodes per node_type

snapchat.research.gbml.graph_schema_pb2.DESCRIPTOR: google.protobuf.descriptor.FileDescriptor[source]#
snapchat.research.gbml.graph_schema_pb2.global___Edge[source]#
snapchat.research.gbml.graph_schema_pb2.global___EdgeType[source]#
snapchat.research.gbml.graph_schema_pb2.global___Graph[source]#
snapchat.research.gbml.graph_schema_pb2.global___GraphMetadata[source]#
snapchat.research.gbml.graph_schema_pb2.global___Node[source]#