Class ArrayAdjacencyGraph<TVertex, TEdge>
Immutable directed graph data structure.
Inheritance
Implements
Inherited Members
Namespace: QuikGraph
Assembly: QuikGraph.dll
Syntax
[Serializable]
public sealed class ArrayAdjacencyGraph<TVertex, TEdge> : IVertexAndEdgeListGraph<TVertex, TEdge>, IVertexListGraph<TVertex, TEdge>, IIncidenceGraph<TVertex, TEdge>, IImplicitGraph<TVertex, TEdge>, IEdgeListGraph<TVertex, TEdge>, IGraph<TVertex, TEdge>, IEdgeSet<TVertex, TEdge>, IVertexSet<TVertex>, IImplicitVertexSet<TVertex>, ICloneable where TEdge : IEdge<TVertex>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type |
Remarks
It is efficient for large sparse graph representation where out-edge need to be enumerated only.
Constructors
| Improve this Doc View SourceArrayAdjacencyGraph(IVertexAndEdgeListGraph<TVertex, TEdge>)
Initializes a new instance of the ArrayAdjacencyGraph<TVertex, TEdge> class.
Declaration
public ArrayAdjacencyGraph(IVertexAndEdgeListGraph<TVertex, TEdge> baseGraph)
Parameters
Type | Name | Description |
---|---|---|
IVertexAndEdgeListGraph<TVertex, TEdge> | baseGraph | Wrapped graph. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Properties
| Improve this Doc View SourceAllowParallelEdges
Gets a value indicating if the graph allows parallel edges
Declaration
public bool AllowParallelEdges { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
EdgeCount
Gets the edge count.
Declaration
public int EdgeCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Edges
Gets the edges.
Declaration
public IEnumerable<TEdge> Edges { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TEdge> |
IsDirected
Gets a value indicating if the graph is directed
Declaration
public bool IsDirected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsEdgesEmpty
Gets a value indicating whether there are no edges in this set. It is true if this edge set is empty, otherwise false.
Declaration
public bool IsEdgesEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsVerticesEmpty
Gets a value indicating whether there are no vertices in this set. It is true if this vertex set is empty, otherwise false.
Declaration
public bool IsVerticesEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
VertexCount
Gets the vertex count.
Declaration
public int VertexCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Vertices
Gets the vertices.
Declaration
public IEnumerable<TVertex> Vertices { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TVertex> |
Methods
| Improve this Doc View SourceClone()
Clones this graph, returns this instance because this class is immutable.
Declaration
public ArrayAdjacencyGraph<TVertex, TEdge> Clone()
Returns
Type | Description |
---|---|
ArrayAdjacencyGraph<TVertex, TEdge> | This graph. |
ContainsEdge(TVertex, TVertex)
Checks if this graph contains an edge that link
source
and target
vertices.
Declaration
public bool ContainsEdge(TVertex source, TVertex target)
Parameters
Type | Name | Description |
---|---|---|
TVertex | source | Source vertex. |
TVertex | target | Target vertex. |
Returns
Type | Description |
---|---|
System.Boolean | True if an edge exists, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ContainsEdge(TEdge)
Determines whether this set contains the specified edge
.
Declaration
public bool ContainsEdge(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | Edge to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the specified |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ContainsVertex(TVertex)
Determines whether this set contains the specified vertex
.
Declaration
public bool ContainsVertex(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | Vertex to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the specified |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
IsOutEdgesEmpty(TVertex)
Determines whether there are out-edges associated to vertex
.
Declaration
public bool IsOutEdgesEmpty(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
Returns
Type | Description |
---|---|
System.Boolean | True if |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
VertexNotFoundException |
|
OutDegree(TVertex)
Gets the count of out-edges of vertex
.
Declaration
public int OutDegree(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
Returns
Type | Description |
---|---|
System.Int32 | The count of out-edges of |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
VertexNotFoundException |
|
OutEdge(TVertex, Int32)
Gets the out-edge of vertex
at position index
.
Declaration
public TEdge OutEdge(TVertex vertex, int index)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
TEdge | The out-edge at position |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException | No vertex at |
VertexNotFoundException |
|
OutEdges(TVertex)
Gets the out-edges of vertex
.
Declaration
public IEnumerable<TEdge> OutEdges(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TEdge> | An enumeration of the out-edges of |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
VertexNotFoundException |
|
TryGetEdge(TVertex, TVertex, out TEdge)
Tries to get the edge that link
source
and target
vertices.
Declaration
public bool TryGetEdge(TVertex source, TVertex target, out TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TVertex | source | Source vertex. |
TVertex | target | Target vertex. |
TEdge | edge | Edge found, otherwise null. |
Returns
Type | Description |
---|---|
System.Boolean | True if an edge was found, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
TryGetEdges(TVertex, TVertex, out IEnumerable<TEdge>)
Tries to get edges that link
source
and target
vertices.
Declaration
public bool TryGetEdges(TVertex source, TVertex target, out IEnumerable<TEdge> edges)
Parameters
Type | Name | Description |
---|---|---|
TVertex | source | Source vertex. |
TVertex | target | Target vertex. |
System.Collections.Generic.IEnumerable<TEdge> | edges | Edges found, otherwise null. |
Returns
Type | Description |
---|---|
System.Boolean | True if at least an edge was found, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
TryGetOutEdges(TVertex, out IEnumerable<TEdge>)
Tries to get the out-edges of vertex
.
Declaration
public bool TryGetOutEdges(TVertex vertex, out IEnumerable<TEdge> edges)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
System.Collections.Generic.IEnumerable<TEdge> | edges | Out-edges. |
Returns
Type | Description |
---|---|
System.Boolean | True if |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Explicit Interface Implementations
| Improve this Doc View SourceICloneable.Clone()
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
System.Object |