public sealed class Route
Represents a path in a graph, travelling from one node to another, through a sequence of edges.

Constructors

Route

#
public Route(int node0, int node1, int[] edges, bool[] reverseDirection)
node0 (int)
node1 (int)
edges (int[])
reverseDirection (bool[])

Properties

Count

#
public int Count { get; }
Gets the number of edges this path consists of.

Node0

#
public int Node0 { get; }
Gets the node at the start of the path.

Node1

#
public int Node1 { get; }
Gets the node at the end of the path.

Methods

EdgeAt

#
public int EdgeAt(int index, out bool reversed)
Gets the edge at the given path index.
index (int)
reversed (out bool)

EdgeAt

#
public int EdgeAt(int index)
Gets the edge at the given path index.
index (int)

FindAnyCycleContainingEdge

#
public static Route FindAnyCycleContainingEdge(Graph graph, int edgeIndex)
Find a cycle containing the indicated edge.
graph (Graph)
edgeIndex (int)
Returns the first found cyclical path connecting either the end of the edge with the start, or the other way around if the edge is two-way.

FindEdge

#
public int FindEdge(int edgeIndex)
Find the index of the first occurrence of the given edge within this path.
edgeIndex (int)

WalkEdges

#
public IEnumerable<(Edge edge, int index, bool reverse)> WalkEdges(Graph graph)
Walk along all the edges this path implies.
graph (Graph)

WalkNodes

#
public IEnumerable<(Node node, int index)> WalkNodes(Graph graph)
Walk along all the nodes this path implies. This does not specifically include the Node0 and Node1 properties, it is assumed that the edges themselves encode this information correctly.
graph (Graph)