xgt.Graph

class xgt.Graph(name)

Defines a new graph type, composed of vertex and edge types.

An instance of Graph is used by the Service.create() function to create a new graph in xGT.

Parameters:
name : str

Graph name.

Examples

>>> import xgt
>>> conn = xgt.connect()
>>> conn.drop_graph('Company')
>>> ng = xgt.Graph('Company')
>>> ...
>>> conn.create(ng)
Attributes:
edges

CustomDictionary: the Edge Types used in the graph.

name

str: Name of the graph.

vertices

CustomDictionary: the Vertex Types used in the graph.

Methods

add(obj) Adds a vertex or an edge object to the graph.
__init__(name)

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

Methods

__init__(name) Initialize self.
add(obj) Adds a vertex or an edge object to the graph.

Attributes

edges CustomDictionary: the Edge Types used in the graph.
name str: Name of the graph.
vertices CustomDictionary: the Vertex Types used in the graph.
add(obj)

Adds a vertex or an edge object to the graph.

Parameters:
obj : Vertex, Edge

An instance of the Vertex or Edge class.

Returns:
Graph

The current Graph object, allowing chaining of methods.

edges

CustomDictionary: the Edge Types used in the graph.

Edges can be accessed either as a list using indices: `graph.edges[1]` or as an object using edge names as attributes: `graph.edges.edge_name`

name

str: Name of the graph.

vertices

CustomDictionary: the Vertex Types used in the graph.

Vertices can be accessed either as a list using indices: `graph.vertices[1]` or as an object using vertex names as attributes: `graph.vertices.vertex_name`