Class Graph<TNodeValue>
Defines an oriented graph with value nodes.
Inherited Members
Namespace: Kephas.Graphs
Assembly: Kephas.Core.dll
Syntax
public class Graph<TNodeValue> : Graph
Type Parameters
Name | Description |
---|---|
TNodeValue | Type of the node value. |
Methods
| Improve this Doc View SourceAddEdge(TNodeValue, TNodeValue)
Adds an edge between two nodes having the given values. If for a value a corresponding node cannot be found, it will be created. If multiple nodes with the same value are found, an exception occurs.
Declaration
public IGraphEdge<TNodeValue> AddEdge(TNodeValue fromValue, TNodeValue toValue)
Parameters
Type | Name | Description |
---|---|---|
TNodeValue | fromValue | The starting node identified by this value. |
TNodeValue | toValue | The ending node identified by this value. |
Returns
Type | Description |
---|---|
IGraphEdge<TNodeValue> | The new edge. |
AddEdge(IGraphNode<TNodeValue>, IGraphNode<TNodeValue>)
Adds an edge between the two nodes.
Declaration
public IGraphEdge<TNodeValue> AddEdge(IGraphNode<TNodeValue> from, IGraphNode<TNodeValue> to)
Parameters
Type | Name | Description |
---|---|---|
IGraphNode<TNodeValue> | from | The starting node. |
IGraphNode<TNodeValue> | to | The ending node. |
Returns
Type | Description |
---|---|
IGraphEdge<TNodeValue> | The new edge. |
AddNode()
Adds a node to the graph and returns it.
Declaration
public IGraphNode<TNodeValue> AddNode()
Returns
Type | Description |
---|---|
IGraphNode<TNodeValue> | The new node. |
AddNode(TNodeValue)
Adds a node with the given value to the graph and returns it.
Declaration
public IGraphNode<TNodeValue> AddNode(TNodeValue value)
Parameters
Type | Name | Description |
---|---|---|
TNodeValue | value | The node value. |
Returns
Type | Description |
---|---|
IGraphNode<TNodeValue> | The new node. |
CreateEdge(GraphNode, GraphNode)
Creates an edge between two nodes.
Declaration
protected override GraphEdge CreateEdge(GraphNode from, GraphNode to)
Parameters
Type | Name | Description |
---|---|---|
GraphNode | from | The starting node. |
GraphNode | to | The ending node. |
Returns
Type | Description |
---|---|
GraphEdge | The new edge. |
Overrides
| Improve this Doc View SourceCreateNode()
Creates a new node.
Declaration
protected override GraphNode CreateNode()
Returns
Type | Description |
---|---|
GraphNode | The new node. |
Overrides
| Improve this Doc View SourceCreateSubgraph()
Creates a subgraph.
Declaration
protected override Graph CreateSubgraph()
Returns
Type | Description |
---|---|
Graph | The new subgraph. |
Overrides
| Improve this Doc View SourceFindNodesByValue(TNodeValue)
Finds the nodes holding the provided value.
Declaration
public IEnumerable<IGraphNode<TNodeValue>> FindNodesByValue(TNodeValue value)
Parameters
Type | Name | Description |
---|---|---|
TNodeValue | value | The node value. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IGraphNode<TNodeValue>> | An enumeration of found nodes. |