Class DynamicGraph
- Namespace
- AlgorithmsSW.Graph
- Assembly
- AlgorithmsSW.dll
public class DynamicGraph : IGraph, IReadOnlyGraph, IEnumerable<(int vertex0, int vertex1)>, IEnumerable
- Inheritance
-
DynamicGraph
- Implements
- Inherited Members
- Extension Methods
Constructors
DynamicGraph(params int[])
public DynamicGraph(params int[] vertexes)
Parameters
vertexes
int[]
Properties
EdgeCount
Gets the number of edges in the graph.
public int EdgeCount { get; set; }
Property Value
SupportsParallelEdges
Gets a value indicating whether the graph supports parallel edges.
public bool SupportsParallelEdges { get; }
Property Value
Remarks
This can be used to ensure algorithms are implemented correctly.
SupportsSelfLoops
Gets a value indicating whether the graph supports self-loops.
public bool SupportsSelfLoops { get; }
Property Value
Remarks
This can be used to ensure algorithms are implemented correctly.
VertexCount
Gets the number of vertices in the graph.
public int VertexCount { get; set; }
Property Value
Vertexes
Gets the vertices in the graph.
public IEnumerable<int> Vertexes { get; }
Property Value
Methods
AddEdge(int, int)
Adds an edge between two vertices in the graph.
public void AddEdge(int vertex0, int vertex1)
Parameters
AddVertexes(params int[])
public void AddVertexes(params int[] vertexes)
Parameters
vertexes
int[]
ContainsEdge(int, int)
Gets whether the graph contains an edge between two vertices.
public bool ContainsEdge(int vertex0, int vertex1)
Parameters
Returns
GetAdjacents(int)
Gets the adjacent vertices of a given vertex.
public IEnumerable<int> GetAdjacents(int vertex)
Parameters
vertex
intThe vertex to find adjacents for.
Returns
- IEnumerable<int>
An enumerable of adjacent vertices.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<(int vertex0, int vertex1)> GetEnumerator()
Returns
- IEnumerator<(int vertex0, int vertex1)>
An enumerator that can be used to iterate through the collection.
RemoveEdge(int, int)
Removes an edge between two vertices in the graph.
public bool RemoveEdge(int vertex0, int vertex1)
Parameters
vertex0
intThe first vertex of the edge to remove.
vertex1
intThe second vertex of the edge to remove.
Returns
RemoveVertex(int)
public void RemoveVertex(int vertex)
Parameters
vertex
int