Class CompressedSparseRowGraph<TVertex>
Directed graph data structure using a compressed sparse row representation. (http://www.cs.utk.edu/~dongarra/etemplates/node373.html)
Inheritance
Implements
Inherited Members
Namespace: QuikGraph
Assembly: QuikGraph.dll
Syntax
[Serializable]
public sealed class CompressedSparseRowGraph<TVertex> : IVertexListGraph<TVertex, SEquatableEdge<TVertex>>, IIncidenceGraph<TVertex, SEquatableEdge<TVertex>>, IImplicitGraph<TVertex, SEquatableEdge<TVertex>>, IEdgeListGraph<TVertex, SEquatableEdge<TVertex>>, IGraph<TVertex, SEquatableEdge<TVertex>>, IEdgeSet<TVertex, SEquatableEdge<TVertex>>, IVertexSet<TVertex>, IImplicitVertexSet<TVertex>, ICloneable
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
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<SEquatableEdge<TVertex>> Edges { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> |
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.
Declaration
public CompressedSparseRowGraph<TVertex> Clone()
Returns
Type | Description |
---|---|
CompressedSparseRowGraph<TVertex> | Cloned 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(SEquatableEdge<TVertex>)
Determines whether this set contains the specified edge
.
Declaration
public bool ContainsEdge(SEquatableEdge<TVertex> edge)
Parameters
Type | Name | Description |
---|---|---|
SEquatableEdge<TVertex> | edge |
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 |
|
FromGraph<TEdge>(IVertexAndEdgeListGraph<TVertex, TEdge>)
Converts the given graph
to a CompressedSparseRowGraph<TVertex>.
Declaration
public static CompressedSparseRowGraph<TVertex> FromGraph<TEdge>(IVertexAndEdgeListGraph<TVertex, TEdge> graph)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
IVertexAndEdgeListGraph<TVertex, TEdge> | graph | Graph to convert. |
Returns
Type | Description |
---|---|
CompressedSparseRowGraph<TVertex> | A corresponding CompressedSparseRowGraph<TVertex>. |
Type Parameters
Name | Description |
---|---|
TEdge | Edge type. |
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 SEquatableEdge<TVertex> OutEdge(TVertex vertex, int index)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
SEquatableEdge<TVertex> | 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<SEquatableEdge<TVertex>> OutEdges(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | An enumeration of the out-edges of |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
VertexNotFoundException |
|
TryGetEdge(TVertex, TVertex, out SEquatableEdge<TVertex>)
Tries to get the edge that link
source
and target
vertices.
Declaration
public bool TryGetEdge(TVertex source, TVertex target, out SEquatableEdge<TVertex> edge)
Parameters
Type | Name | Description |
---|---|---|
TVertex | source | Source vertex. |
TVertex | target | Target vertex. |
SEquatableEdge<TVertex> | edge |
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<SEquatableEdge<TVertex>>)
Tries to get edges that link
source
and target
vertices.
Declaration
public bool TryGetEdges(TVertex source, TVertex target, out IEnumerable<SEquatableEdge<TVertex>> edges)
Parameters
Type | Name | Description |
---|---|---|
TVertex | source | Source vertex. |
TVertex | target | Target vertex. |
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | edges |
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<SEquatableEdge<TVertex>>)
Tries to get the out-edges of vertex
.
Declaration
public bool TryGetOutEdges(TVertex vertex, out IEnumerable<SEquatableEdge<TVertex>> edges)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex. |
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | 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 |