Table of Contents

Class EuclideanDistanceDigraph

Namespace
AlgorithmsSW.EdgeWeightedDigraph
Assembly
AlgorithmsSW.dll

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

[ExerciseReference(4, 4, 27)]
public class EuclideanDistanceDigraph : IEdgeWeightedDigraph<double>, IReadOnlyEdgeWeightedDigraph<double>, IReadOnlyDigraph, IEnumerable<(int vertex0, int vertex1)>, IEnumerable
Inheritance
EuclideanDistanceDigraph
Implements
Inherited Members
Extension Methods

Constructors

EuclideanDistanceDigraph(IEnumerable<Vector3>)

Initializes a new instance of the EuclideanDistanceDigraph class.

public EuclideanDistanceDigraph(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

public bool SupportsParallelEdges { get; }

Property Value

bool

SupportsSelfLoops

public bool SupportsSelfLoops { get; }

Property Value

bool

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 IReadOnlyEdgeWeightedDigraph<TWeight>.

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

Property Value

IEnumerable<DirectedEdge<double>>

Methods

AddEdge(DirectedEdge<double>)

Adds an edge to the graph.

public void AddEdge(DirectedEdge<double> edge)

Parameters

edge DirectedEdge<double>

The edge to add.

AddEdge(int, int)

Adds an edge to the digraph.

public void AddEdge(int source, int target)

Parameters

source int

The source vertex of the edge.

target int

The target vertex of the edge.

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<DirectedEdge<double>> GetIncidentEdges(int vertex)

Parameters

vertex int

The vertex to get the incident edges of.

Returns

IEnumerable<DirectedEdge<double>>

An enumerable of incident edges.

MakeEdge(int, int)

public DirectedEdge<double> MakeEdge(int source, int target)

Parameters

source int
target int

Returns

DirectedEdge<double>

RemoveEdge(DirectedEdge<double>)

Removes an edge from the graph.

public bool RemoveEdge(DirectedEdge<double> edge)

Parameters

edge DirectedEdge<double>

The edge to remove.

Returns

bool

true if the edge was removed, false otherwise.