Show / Hide Table of Contents

    Class WeightedGraph<T, TW>

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

    Inheritance
    Object
    WeightedGraph<T, TW>
    Implements
    IEnumerable<T>
    IEnumerable
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Advanced.Algorithms.DataStructures.Graph.AdjacencyMatrix
    Assembly: Advanced.Algorithms.dll
    Syntax
    public class WeightedGraph<T, TW> : IEnumerable<T>, IEnumerable where TW : IComparable
    Type Parameters
    Name Description
    T
    TW

    Constructors

    WeightedGraph()

    Declaration
    public WeightedGraph()

    Properties

    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

    Edges(T)

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

    GetEnumerator()

    Declaration
    public IEnumerator<T> GetEnumerator()
    Returns
    Type Description
    IEnumerator<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

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    Implements

    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    Back to top Generated by DocFX