Class UndirectedAdjacencyListGraph<T>
A graph where edges are represented as an adjacency lists.
Inheritance
System.Object
UndirectedAdjacencyListGraph<T>
Implements
IGraph<T>
Namespace: Edgar.Graphs
Assembly: Edgar.dll
Syntax
public class UndirectedAdjacencyListGraph<T> : Object, IGraph<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
UndirectedAdjacencyListGraph()
Declaration
public UndirectedAdjacencyListGraph()
Properties
Edges
Gets all edges of the graph.
Declaration
public IEnumerable<IEdge<T>> Edges { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IEdge<T>> |
IsDirected
Checks if the graph is directed.
Declaration
public bool IsDirected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Vertices
Gets all vertices of the graph.
Declaration
public IEnumerable<T> Vertices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> |
VerticesCount
Gets the total number of vertices.
Declaration
public int VerticesCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
AddEdge(T, T)
Adds an edge.
Declaration
public void AddEdge(T from, T to)
Parameters
Type | Name | Description |
---|---|---|
T | from | |
T | to |
AddVertex(T)
Adds a vertex.
Declaration
public void AddVertex(T vertex)
Parameters
Type | Name | Description |
---|---|---|
T | vertex |
GetNeighbours(T)
Gets all neighbours of a given vertex.
Declaration
public IEnumerable<T> GetNeighbours(T vertex)
Parameters
Type | Name | Description |
---|---|---|
T | vertex |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> |
HasEdge(T, T)
Checks whether there exists a given edge.
Declaration
public bool HasEdge(T from, T to)
Parameters
Type | Name | Description |
---|---|---|
T | from | |
T | to |
Returns
Type | Description |
---|---|
System.Boolean |