Show / Hide Table of Contents

    Class Graph<T>

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

    Inheritance
    Object
    Graph<T>
    Implements
    IGraph<T>
    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 Graph<T> : IGraph<T>, IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    Constructors

    Graph()

    Declaration
    public Graph()

    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)

    Add an edge from source to destination vertex. Time complexity: O(1).

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

    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()

    Declaration
    public Graph<T> Clone()
    Returns
    Type Description
    Graph<T>

    ContainsVertex(T)

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

    Edges(T)

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

    EdgesCount(T)

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

    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 the 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 an existing edge between source and destination. Time complexity: O(1).

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

    RemoveVertex(T)

    Remove an existing vertex from 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

    IGraph<T>.Clone()

    Declaration
    IGraph<T> IGraph<T>.Clone()
    Returns
    Type Description
    IGraph<T>

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    Implements

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