Table of Contents

Class DirectedGraph<TNodeValue, TEdgeLabel>

Namespace
Bonsai.Dag
Assembly
Bonsai.Core.dll

Represents a directed graph that consists of labeled nodes and edges.

public class DirectedGraph<TNodeValue, TEdgeLabel> : ICollection<Node<TNodeValue, TEdgeLabel>>, IReadOnlyList<Node<TNodeValue, TEdgeLabel>>, IReadOnlyCollection<Node<TNodeValue, TEdgeLabel>>, IEnumerable<Node<TNodeValue, TEdgeLabel>>, IEnumerable

Type Parameters

TNodeValue

The type of the labels associated with graph nodes.

TEdgeLabel

The type of the labels associated with graph edges.

Inheritance
DirectedGraph<TNodeValue, TEdgeLabel>
Implements
ICollection<Node<TNodeValue, TEdgeLabel>>
IReadOnlyList<Node<TNodeValue, TEdgeLabel>>
IReadOnlyCollection<Node<TNodeValue, TEdgeLabel>>
IEnumerable<Node<TNodeValue, TEdgeLabel>>
Derived
Inherited Members
Extension Methods

Constructors

DirectedGraph()

Initializes a new instance of the DirectedGraph<TNodeValue, TEdgeLabel> class.

Properties

Count

Gets the number of nodes in the directed graph.

this[int]

Gets the node at the specified index.

Methods

Add(Node<TNodeValue, TEdgeLabel>)

Adds a node and all its successors to the directed graph.

Add(TNodeValue)

Creates and adds a new node with the specified value to the directed graph.

AddEdge(Node<TNodeValue, TEdgeLabel>, Edge<TNodeValue, TEdgeLabel>)

Adds a labeled outgoing edge from the specified node in the directed graph.

AddEdge(Node<TNodeValue, TEdgeLabel>, Node<TNodeValue, TEdgeLabel>, TEdgeLabel)

Creates and adds a new labeled edge linking the specified nodes in the directed graph.

AddRange(IEnumerable<Node<TNodeValue, TEdgeLabel>>)

Adds the nodes in a collection to the end of the directed graph.

Clear()

Removes all nodes and corresponding edges from the directed graph.

Contains(Node<TNodeValue, TEdgeLabel>)

Determines whether a node is in the directed graph.

CopyTo(Node<TNodeValue, TEdgeLabel>[])

Copies all the nodes in the directed graph to a compatible one-dimensional array, starting at the beginning of the target array.

CopyTo(Node<TNodeValue, TEdgeLabel>[], int)

Copies all the nodes in the directed graph to a compatible one-dimensional array, starting at the specified index of the target array.

GetEnumerator()

Returns an enumerator that iterates through the nodes in the directed graph.

IndexOf(Node<TNodeValue, TEdgeLabel>)

Searches for the specified node and returns its zero-based index within the collection.

Insert(int, Node<TNodeValue, TEdgeLabel>)

Inserts a node into the directed graph at the specified index.

Insert(int, TNodeValue)

Creates and inserts a new node with the specified value into the directed graph at the specified index.

InsertEdge(Node<TNodeValue, TEdgeLabel>, int, Edge<TNodeValue, TEdgeLabel>)

Inserts a labeled outgoing edge of a source node at the specified index.

InsertEdge(Node<TNodeValue, TEdgeLabel>, int, Node<TNodeValue, TEdgeLabel>, TEdgeLabel)

Creates and inserts a labeled outgoing edge of the source node at the specified index.

InsertRange(int, IEnumerable<Node<TNodeValue, TEdgeLabel>>)

Inserts the nodes in a collection into the directed graph at the specified index.

Remove(Node<TNodeValue, TEdgeLabel>)

Removes the specified node from the directed graph.

RemoveAt(int)

Removes the node at the specified index of the directed graph.

RemoveEdge(Node<TNodeValue, TEdgeLabel>, Edge<TNodeValue, TEdgeLabel>)

Removes the specified edge from the directed graph.

RemoveRange(int, int)

Removes a range of nodes from the directed graph.

RemoveWhere(Predicate<Node<TNodeValue, TEdgeLabel>>)

Removes all nodes that match the conditions defined by the specified predicate from the directed graph.

SetEdge(Node<TNodeValue, TEdgeLabel>, int, Edge<TNodeValue, TEdgeLabel>)

Replaces a labeled outgoing edge of a source node at the specified index.

SetEdge(Node<TNodeValue, TEdgeLabel>, int, Node<TNodeValue, TEdgeLabel>, TEdgeLabel)

Creates and replaces a labeled outgoing edge of the source node at the specified index.