Class Path
A Path denotes a particular walk through a graph as defined by a ITraversal.
Implements
Inherited Members
Namespace: Gremlin.Net.Structure
Assembly: Gremlin.Net.dll
Syntax
public class Path : IReadOnlyList<object?>, IReadOnlyCollection<object?>, IEnumerable<object?>, IEnumerable, IEquatable<Path>
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.
Declaration
public Path(IList<ISet<string>> labels, IList<object?> objects)
Parameters
Type | Name | Description |
---|---|---|
IList<ISet<string>> | labels | The labels associated with the path |
IList<object> | objects | The objects in the Path. |
Properties
Count
Gets the number of steps in the path.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
this[int]
Get the object associated with the specified index into the path.
Declaration
public dynamic? this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the path |
Property Value
Type | Description |
---|---|
dynamic | The object associated with the index of the path |
this[string]
Gets the object associated with the particular label of the path.
Declaration
public object this[string label] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | label | The label of the path |
Property Value
Type | Description |
---|---|
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
Type | Condition |
---|---|
KeyNotFoundException | Thrown if the path does not contain the label. |
Labels
Gets an ordered list of the labels associated with the Path.
Declaration
public IList<ISet<string>> Labels { get; }
Property Value
Type | Description |
---|---|
IList<ISet<string>> |
Objects
Gets an ordered list of the objects in the Path.
Declaration
public IList<object?> Objects { get; }
Property Value
Type | Description |
---|---|
IList<object> |
Methods
ContainsKey(string)
Returns true if the path has the specified label, else return false.
Declaration
public bool ContainsKey(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The label to search for. |
Returns
Type | Description |
---|---|
bool | True if the label exists in the path. |
Equals(Path?)
Declaration
public bool Equals(Path? other)
Parameters
Type | Name | Description |
---|---|---|
Path | other |
Returns
Type | Description |
---|---|
bool |
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
GetEnumerator()
Declaration
public IEnumerator<object> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<object> |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
TryGetValue(string, out object?)
Tries to get the object associated with the particular label of the path.
Declaration
public bool TryGetValue(string label, out object? value)
Parameters
Type | Name | Description |
---|---|---|
string | label | The label of the path. |
object | value | The object associated with the label of the path. |
Returns
Type | Description |
---|---|
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.