Show / Hide Table of Contents

    Class WeightedGraph<T, TW>

    A weighted graph implementation using dynamically growing/shrinking adjacency matrix array. IEnumerable enumerates all vertices.

    Inheritance
    Object
    WeightedGraph<T, TW>
    Implements
    IEnumerable<T>
    Namespace: Advanced.Algorithms.DataStructures.Graph.AdjacencyMatrix
    Assembly: Advanced.Algorithms.dll
    Syntax
    public class WeightedGraph<T, TW> : IGraph<T>, IEnumerable<T> where TW : IComparable
    Type Parameters
    Name Description
    T
    TW

    Constructors

    WeightedGraph()

    Declaration
    public WeightedGraph()

    Properties

    IsWeightedGraph

    Declaration
    public bool IsWeightedGraph { get; }
    Property Value
    Type Description
    Boolean

    ReferenceVertex

    Declaration
    public IGraphVertex<T> ReferenceVertex { get; }
    Property Value
    Type Description
    IGraphVertex<T>

    VerticesAsEnumberable

    Declaration
    public IEnumerable<IGraphVertex<T>> VerticesAsEnumberable { get; }
    Property Value
    Type Description
    IEnumerable<IGraphVertex<T>>

    VerticesCount

    Declaration
    public int VerticesCount { get; }
    Property Value
    Type Description
    Int32

    Methods

    AddEdge(T, T, TW)

    Add a new edge to this graph with given weight and between given source and destination vertex. Time complexity: O(1).

    Declaration
    public void AddEdge(T source, T dest, TW weight)
    Parameters
    Type Name Description
    T source
    T dest
    TW weight

    AddVertex(T)

    Add a new vertex to this graph. Time complexity: O(1).

    Declaration
    public void AddVertex(T value)
    Parameters
    Type Name Description
    T value

    Clone()

    Clones this graph.

    Declaration
    public WeightedGraph<T, TW> Clone()
    Returns
    Type Description
    WeightedGraph<T, TW>

    ContainsVertex(T)

    Declaration
    public bool ContainsVertex(T key)
    Parameters
    Type Name Description
    T key
    Returns
    Type Description
    Boolean

    EdgeCount(T)

    Declaration
    public int EdgeCount(T vertex)
    Parameters
    Type Name Description
    T vertex
    Returns
    Type Description
    Int32

    Edges(T)

    Declaration
    public IEnumerable<KeyValuePair<T, TW>> Edges(T vertex)
    Parameters
    Type Name Description
    T vertex
    Returns
    Type Description
    IEnumerable<KeyValuePair<T, TW>>

    GetEnumerator()

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<T>

    GetVertex(T)

    Declaration
    public IGraphVertex<T> GetVertex(T key)
    Parameters
    Type Name Description
    T key
    Returns
    Type Description
    IGraphVertex<T>

    HasEdge(T, T)

    Do we have an edge between given source and destination? Time complexity: O(1).

    Declaration
    public bool HasEdge(T source, T dest)
    Parameters
    Type Name Description
    T source
    T dest
    Returns
    Type Description
    Boolean

    RemoveEdge(T, T)

    Remove given edge. Time complexity: O(1).

    Declaration
    public void RemoveEdge(T source, T dest)
    Parameters
    Type Name Description
    T source
    T dest

    RemoveVertex(T)

    Remove given vertex from this graph. Time complexity: O(V) where V is the number of vertices.

    Declaration
    public void RemoveVertex(T value)
    Parameters
    Type Name Description
    T value

    Implements

    IEnumerable<>
    Back to top Generated by DocFX