Interface IReadOnlyGraph
- Namespace
- AlgorithmsSW.Graph
- Assembly
- AlgorithmsSW.dll
Represents a graph data structure.
public interface IReadOnlyGraph : IEnumerable<(int vertex0, int vertex1)>, IEnumerable
- Inherited Members
- Extension Methods
Remarks
Self-loops are supported, but parallel edges are not.
Properties
EdgeCount
Gets the number of edges in the graph.
int EdgeCount { get; }
Property Value
IsEmpty
Gets a value indicating whether the graph is empty (no vertices).
bool IsEmpty { get; }
Property Value
VertexCount
Gets the number of vertices in the graph.
int VertexCount { get; }
Property Value
Vertexes
Gets the vertices in the graph.
IEnumerable<int> Vertexes { get; }
Property Value
Methods
AsText()
Creates a human-readable string representation of the graph.
string AsText()
Returns
- string
A string representing the graph's structure.
ContainsEdge(int, int)
Gets whether the graph contains an edge between two vertices.
bool ContainsEdge(int vertex0, int vertex1)
Parameters
Returns
GetAdjacents(int)
Gets the adjacent vertices of a given vertex.
IEnumerable<int> GetAdjacents(int vertex)
Parameters
vertex
intThe vertex to find adjacents for.
Returns
- IEnumerable<int>
An enumerable of adjacent vertices.