Table of Contents

Class Path

Namespace
Gremlin.Net.Structure
Assembly
Gremlin.Net.dll

A Path denotes a particular walk through a graph as defined by a ITraversal.

public class Path : IReadOnlyList<object?>, IReadOnlyCollection<object?>, IEnumerable<object?>, IEnumerable, IEquatable<Path>
Inheritance
Path
Implements
Inherited Members

Remarks

In abstraction, any Path implementation maintains two lists: a list of sets of labels and a list of objects. The list of labels are the labels of the steps traversed. The list of objects are the objects traversed.

Constructors

Path(IList<ISet<string>>, IList<object?>)

Initializes a new instance of the Path class.

public Path(IList<ISet<string>> labels, IList<object?> objects)

Parameters

labels IList<ISet<string>>

The labels associated with the path

objects IList<object>

The objects in the Path.

Properties

Count

Gets the number of steps in the path.

public int Count { get; }

Property Value

int

this[int]

Get the object associated with the specified index into the path.

public dynamic? this[int index] { get; }

Parameters

index int

The index of the path

Property Value

dynamic

The object associated with the index of the path

this[string]

Gets the object associated with the particular label of the path.

public object this[string label] { get; }

Parameters

label string

The label of the path

Property Value

object

The object associated with the label of the path

Remarks

If the path has multiple labels of the type, then get a collection of those objects.

Exceptions

KeyNotFoundException

Thrown if the path does not contain the label.

Labels

Gets an ordered list of the labels associated with the Path.

public IList<ISet<string>> Labels { get; }

Property Value

IList<ISet<string>>

Objects

Gets an ordered list of the objects in the Path.

public IList<object?> Objects { get; }

Property Value

IList<object>

Methods

ContainsKey(string)

Returns true if the path has the specified label, else return false.

public bool ContainsKey(string key)

Parameters

key string

The label to search for.

Returns

bool

True if the label exists in the path.

Equals(Path?)

public bool Equals(Path? other)

Parameters

other Path

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetEnumerator()

public IEnumerator<object> GetEnumerator()

Returns

IEnumerator<object>

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

TryGetValue(string, out object?)

Tries to get the object associated with the particular label of the path.

public bool TryGetValue(string label, out object? value)

Parameters

label string

The label of the path.

value object

The object associated with the label of the path.

Returns

bool

True, if an object was found for the label.

Remarks

If the path has multiple labels of the type, then get a collection of those objects.