Table of Contents

Class EuclideanDistanceGraph

Namespace
AlgorithmsSW.EdgeWeightedGraph
Assembly
AlgorithmsSW.dll

Graph where the weight of the edges is the euclidean distance between the vertexes, which are points in 3D space.

public class EuclideanDistanceGraph : IEdgeWeightedGraph<double>, IReadOnlyEdgeWeightedGraph<double>, IReadOnlyGraph, IEnumerable<(int vertex0, int vertex1)>, IEnumerable
Inheritance
EuclideanDistanceGraph
Implements
Inherited Members
Extension Methods

Constructors

EuclideanDistanceGraph(IEnumerable<Vector3>)

Initializes a new instance of the EuclideanDistanceGraph class.

public EuclideanDistanceGraph(IEnumerable<Vector3> vertexes)

Parameters

vertexes IEnumerable<Vector3>

The spatial representation of the vertexes.

Properties

EdgeCount

Gets the number of edges in the graph.

public int EdgeCount { get; }

Property Value

int

SupportsParallelEdges

Gets a value indicating whether the graph supports parallel edges.

public bool SupportsParallelEdges { get; }

Property Value

bool

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

bool

Remarks

This can be used to ensure algorithms are implemented correctly.

VertexCount

Gets the number of vertices in the graph.

public int VertexCount { get; }

Property Value

int

WeightedEdges

Gets the edges that is part of this IReadOnlyEdgeWeightedGraph<TWeight>.

public IEnumerable<Edge<double>> WeightedEdges { get; }

Property Value

IEnumerable<Edge<double>>

Methods

AddEdge(Edge<double>)

Adds an edge to the graph.

public void AddEdge(Edge<double> edge)

Parameters

edge Edge<double>

The edge to add.

AddEdge(int, int)

Adds an edge between the two given vertexes to the graph.

public Edge<double> AddEdge(int vertex0, int vertex1)

Parameters

vertex0 int

The first vertex of the edge to add.

vertex1 int

The second vertex of the edge to add.

Returns

Edge<double>

The added edge.

ContainsEdge(int, int)

Gets whether the graph contains an edge between two vertices.

public bool ContainsEdge(int vertex0, int vertex1)

Parameters

vertex0 int
vertex1 int

Returns

bool

GetAdjacents(int)

Gets the adjacent vertices of a given vertex.

public IEnumerable<int> GetAdjacents(int vertex)

Parameters

vertex int

The 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.

GetIncidentEdges(int)

Gets the edges that is incident to the given vertex.

public IEnumerable<Edge<double>> GetIncidentEdges(int vertex)

Parameters

vertex int

The vertex to get the incident edges of.

Returns

IEnumerable<Edge<double>>

MakeEdge(int, int)

Makes an edge between the two given vertexes.

public Edge<double> MakeEdge(int vertex0, int vertex1)

Parameters

vertex0 int

The first vertex of the edge to make.

vertex1 int

The second vertex of the edge to make.

Returns

Edge<double>

An edge between the two given vertexes.

Remarks

The weight of the edge is the euclidean distance between the vertexes.

RemoveEdge(Edge<double>)

Represents a weighted graph data structure.

public bool RemoveEdge(Edge<double> edge)

Parameters

edge Edge<double>

Returns

bool