Show / Hide Table of Contents

    Class Graph<T>

    A graph implementation IEnumerable enumerates all vertices.

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

    Constructors

    Graph()

    Declaration
    public Graph()

    Properties

    IsWeightedGraph

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

    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 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 void AddVertex(T value)
    Parameters
    Type Name Description
    T value

    Clone()

    Clones this graph.

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

    ContainsVertex(T)

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

    Edges(T)

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

    GetEnumerator()

    Declaration
    public IEnumerator GetEnumerator()
    Returns
    Type Description
    IEnumerator

    GetVertex(T)

    Declaration
    public IGraphVertex<T> GetVertex(T value)
    Parameters
    Type Name Description
    T value
    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 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

    Implements

    IEnumerable<>
    Back to top Generated by DocFX