Show / Hide Table of Contents

    Class Graph<T>

    A graph implementation IEnumerable enumerates all vertices.

    Inheritance
    Object
    Graph<T>
    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.AdjacencyList
    Assembly: Advanced.Algorithms.dll
    Syntax
    public class Graph<T> : IEnumerable<T>, IEnumerable
    Type Parameters
    Name Description
    T

    Constructors

    Graph()

    Declaration
    public Graph()

    Properties

    ReferenceVertex

    Returns a reference vertex. Time complexity: O(1).

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

    VerticesCount

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

    Methods

    AddEdge(T, T)

    Add an edge to this graph. 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 GraphVertex<T> AddVertex(T value)
    Parameters
    Type Name Description
    T value
    Returns
    Type Description
    GraphVertex<T>

    Edges(T)

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

    FindVertex(T)

    Returns the vertex object with the given value. Time complexity: O(1).

    Declaration
    public GraphVertex<T> FindVertex(T value)
    Parameters
    Type Name Description
    T value
    Returns
    Type Description
    GraphVertex<T>

    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 an edge from this graph. 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 this graph. Time complexity: O(V) where V is the number of vertices.

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

    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