xgt.Edge

class xgt.Edge(name, schema, source, target)

Defines a new edge type.

Edge objects capture the names and datatypes of properties on edges, and they are required in order to define a new graph.

Parameters:
name : str

Edge type name.

schema : list of tuples

List of tuples associating property names with xGT data types.

source : list of tuples

Each tuple maps the name of an edge property to the name of a ‘key’ property of a vertex, which is used as the source of the edge.

target : list of tuples

Each tuple maps the name of an edge property to the name of a ‘key’ property of a vertex, which is used as the target of the edge.

Examples

>>> import xgt
>>> conn = xgt.connect()
>>> conn.drop_graph('Company')
>>> ng = xgt.Graph('Company')
>>> v1 = ...
>>> v2 = ...
>>> e1 = xgt.Edge(name   = 'WorksFor',
...               schema = [('srcid', xgt.INT),
...                         ('trgid', xgt.INT)],
...               source = [('srcid', v1.key.id)],
...               target = [('trgid', v2.key.id)])
>>> ng.add(v1).add(v2).add(e1)
>>> conn.create(ng)
Attributes:
name

str: Name of the edge type.

schema

list of tuples: List of name-type pairs.

__init__(name, schema, source, target)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(name, schema, source, target) Initialize self.

Attributes

name str: Name of the edge type.
schema list of tuples: List of name-type pairs.
name

str: Name of the edge type.

schema

list of tuples: List of name-type pairs.