Class Graph
Defines an oriented graph.
Inherited Members
Namespace: Kephas.Graphs
Assembly: Kephas.Core.dll
Syntax
public class Graph
Properties
| Improve this Doc View SourceEdges
Gets a list of the graph edges.
Declaration
public IReadOnlyList<IGraphEdge> Edges { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<IGraphEdge> |
Nodes
Gets a list of the graph nodes.
Declaration
public IReadOnlyList<IGraphNode> Nodes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<IGraphNode> |
Methods
| Improve this Doc View SourceAddEdge(IGraphEdge)
Adds an edge to the graph, if not already contained.
Declaration
protected bool AddEdge(IGraphEdge edge)
Parameters
Type | Name | Description |
---|---|---|
IGraphEdge | edge | The edge to be added. |
Returns
Type | Description |
---|---|
System.Boolean |
|
AddEdge(IGraphNode, IGraphNode)
Adds an edge between the two nodes.
Declaration
public virtual IGraphEdge AddEdge(IGraphNode from, IGraphNode to)
Parameters
Type | Name | Description |
---|---|---|
IGraphNode | from | The starting node. |
IGraphNode | to | The ending node. |
Returns
Type | Description |
---|---|
IGraphEdge | The new edge. |
AddNode()
Adds a node to the graph and returns it.
Declaration
public virtual IGraphNode AddNode()
Returns
Type | Description |
---|---|
IGraphNode | The new node. |
AddNode(IGraphNode)
Adds a node to the graph, if not already contained.
Declaration
protected bool AddNode(IGraphNode node)
Parameters
Type | Name | Description |
---|---|---|
IGraphNode | node | The node to be added. |
Returns
Type | Description |
---|---|
System.Boolean |
|
CreateEdge(GraphNode, GraphNode)
Creates an edge between two nodes.
Declaration
protected virtual 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. |
CreateNode()
Creates a new node.
Declaration
protected virtual GraphNode CreateNode()
Returns
Type | Description |
---|---|
GraphNode | The new node. |
CreateSubgraph()
Creates a subgraph.
Declaration
protected virtual Graph CreateSubgraph()
Returns
Type | Description |
---|---|
Graph | The new subgraph. |
HasEdge(IGraphNode, IGraphNode)
Indicates whether the graph has an edge with the indicated nodes.
Declaration
public bool HasEdge(IGraphNode from, IGraphNode to)
Parameters
Type | Name | Description |
---|---|---|
IGraphNode | from | The starting node. |
IGraphNode | to | The ending node. |
Returns
Type | Description |
---|---|
System.Boolean |
|