1. Two Syntax Forms

Arc syntax is common for all methods that take arc= arguments. There are two distinct syntax forms, one for arc insertion and one for arc filters.

2. Arc Insertion

Methods that create relationships between vertices accept a tuple of zero, one, two, or three elements in the arc= parameter.

Inserting or modifying a relationship will always create an outbound arc from the initial to the terminal vertex.

2.1. Arc Insertion Syntax

<arc> ::= ( [ <relationship> [, <modifier> [, <value> ] ] ] )

2.2. Arc Elements

Parameter Type Default Value Comment

<relationship>

<str>

"__related__"

Relationship type names are enumerated as integers internally in the graph, using a limited enumeration space. The maximum number of unique relationship types allowed per graph instance is 15616. An insertion attempt that exhausts the enumeration space will raise pyvgx.EnumerationError

<modifier>

Arc Modifier

pyvgx.M_STAT

Arc modifier constants are integer values. Although a method will perform the correct operation if the correct plain integer is used for the arc modifier, the method behavior is generally undefined if an invalid integer is passed.

<value>

<int>

<float>

<modifier> dependent

The value type and range depend on the modifier.

2.3. Shortcut Notation

Insert a fully unspecified arc pass None or the empty tuple ()
arc = None
arc = ()
Insert an arc with unspecified relationship type, pass None for <relationship>
arc = ( None, <modifier>, <value> )

2.4. Automatic Value Assignment

Create arc and set creation time to now (set once, cannot be changed)
arc = ( <relationship>, pyvgx.M_TMC )
Create/modify arc and update modification time to current time
arc = ( <relationship>, pyvgx.M_TMM )
Counter (integer value)
# Increment arc value, or set it to <assign_value>
arc = ( <relationship>, pyvgx.M_CNT[, <assign_value>] )
Accumulator (float value)
# Accumulate arc value, or set it to <assign_value>
arc = ( <relationship>, pyvgx.M_ACC[, <assign_value>] )

3. Arc Filter

Query methods that support the arc= parameter accept a filter tuple of zero, one, two, three or five elements. (Four-element tuples are not valid since <condition> also requires <value>.)

The filter logic is inverted when wrapping the filter tuple within another tuple (False, filter).

3.1. Arc Filter Syntax

positive (default) logic
arcfilter ::= ( [ <relationship> [, <direction> [, <modifier> [, <condition>, <value> ] ] ] ] )
inverse logic
arcfilter ::= ( False, ( [ <relationship> [, <direction> [, <modifier> [, <condition>, <value> ] ] ] ] ) )

3.2. Arc Filter Elements

Parameter Type Default Value Comment

<relationship>

<str>

None

To match any relationship type use None or "*".

Wildcard syntax for partial string match is not supported.

<direction>

Arc Direction

Query method dependent

<modifier>

Arc Modifier

pyvgx.M_ANY

<condition>

Value Condition

-

Specifying a <condition> also requires <modifier> and <value> to be specified. The specified <modifier> cannot be pyvgx.M_ANY.

<value>

<numeric>

or

( <numeric>, <numeric> )

-

Depending on the <condition> code this may either be a single numeric value n or a 2-tuple (a, b).

3.3. Shortcut Notation

Match any arc by specifying None or the empty tuple ()
arc = None
arc = ()
Match any relationship by using None for <relationship>
arc = ( None, <modifier>, ... )

PYVGX