Table of Contents

Class Connectivity

Namespace
AlgorithmsSW.Graph
Assembly
AlgorithmsSW.dll

A class for querying connectivity properties of a graph.

public class Connectivity
Inheritance
Connectivity
Inherited Members
Extension Methods

Constructors

Connectivity(IReadOnlyGraph)

Initializes a new instance of the Connectivity class from the given graph.

public Connectivity(IReadOnlyGraph graph)

Parameters

graph IReadOnlyGraph

The graph to analyze.

Properties

ComponentCount

Gets the total number of connected components in the graph.

public int ComponentCount { get; }

Property Value

int

IsConnected

Gets a value indicating whether the entire graph is connected as a single component.

public bool IsConnected { get; }

Property Value

bool

Methods

AreConnected(int, int)

Determines if two vertices are connected.

public bool AreConnected(int vertex0, int vertex1)

Parameters

vertex0 int

The first vertex.

vertex1 int

The second vertex.

Returns

bool

true if the vertices are connected; otherwise, false.

GetComponentIndex(int)

public int GetComponentIndex(int vertex)

Parameters

vertex int

Returns

int

GetShortestPathBetween(int, int)

Gets the shortest path between two vertices.

public IEnumerable<int> GetShortestPathBetween(int vertex0, int vertex1)

Parameters

vertex0 int

The starting vertex.

vertex1 int

The ending vertex.

Returns

IEnumerable<int>

An enumerable of integers representing the shortest path.