Table of Contents

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

int

IsEmpty

Gets a value indicating whether the graph is empty (no vertices).

bool IsEmpty { get; }

Property Value

bool

VertexCount

Gets the number of vertices in the graph.

int VertexCount { get; }

Property Value

int

Vertexes

Gets the vertices in the graph.

IEnumerable<int> Vertexes { get; }

Property Value

IEnumerable<int>

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

vertex0 int
vertex1 int

Returns

bool

GetAdjacents(int)

Gets the adjacent vertices of a given vertex.

IEnumerable<int> GetAdjacents(int vertex)

Parameters

vertex int

The vertex to find adjacents for.

Returns

IEnumerable<int>

An enumerable of adjacent vertices.