Class EdgeListGraph<TVertex, TEdge>
Mutable edge list graph data structure.
Inheritance
Implements
Inherited Members
Namespace: QuikGraph
Assembly: QuikGraph.dll
Syntax
[Serializable]
public class EdgeListGraph<TVertex, TEdge> : IMutableEdgeListGraph<TVertex, TEdge>, IMutableGraph<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
Only mutable by its edges, vertices are not stored but computed on demand.
Constructors
| Improve this Doc View SourceEdgeListGraph()
Initializes a new instance of the EdgeListGraph<TVertex, TEdge> class.
Declaration
public EdgeListGraph()
EdgeListGraph(Boolean, Boolean)
Initializes a new instance of the EdgeListGraph<TVertex, TEdge> class.
Declaration
public EdgeListGraph(bool isDirected, bool allowParallelEdges)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDirected | Indicates if the graph is directed. |
System.Boolean | allowParallelEdges | Indicates if parallel edges are allowed. |
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 SourceAddEdge(TEdge)
Adds the edge
to this graph.
Declaration
public bool AddEdge(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | An edge. |
Returns
Type | Description |
---|---|
System.Boolean | True if the edge was added, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
AddEdgeRange(IEnumerable<TEdge>)
Adds a set of edges to this graph.
Declaration
public int AddEdgeRange(IEnumerable<TEdge> edges)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TEdge> | edges | Edges to add. |
Returns
Type | Description |
---|---|
System.Int32 | The number of edges successfully added to this graph. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
AddVerticesAndEdge(TEdge)
Adds edge
and its vertices to this graph.
Declaration
public bool AddVerticesAndEdge(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | The edge to add. |
Returns
Type | Description |
---|---|
System.Boolean | True if the edge was added, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
AddVerticesAndEdgeRange(IEnumerable<TEdge>)
Adds a set of edges (and it's vertices if necessary).
Declaration
public int AddVerticesAndEdgeRange(IEnumerable<TEdge> edges)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TEdge> | edges | Edges to add. |
Returns
Type | Description |
---|---|
System.Int32 | The number of edges added. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Clear()
Clears the vertex and edges.
Declaration
public void Clear()
Clone()
Clones this graph.
Declaration
public EdgeListGraph<TVertex, TEdge> Clone()
Returns
Type | Description |
---|---|
EdgeListGraph<TVertex, TEdge> | Cloned graph. |
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 |
|
OnEdgeAdded(TEdge)
Called on each added edge.
Declaration
protected virtual void OnEdgeAdded(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | Added edge. |
OnEdgeRemoved(TEdge)
Called on each removed edge.
Declaration
protected virtual void OnEdgeRemoved(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | Removed edge. |
RemoveEdge(TEdge)
Removes the edge
from this graph.
Declaration
public bool RemoveEdge(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | Edge to remove. |
Returns
Type | Description |
---|---|
System.Boolean | True if the |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
RemoveEdgeIf(EdgePredicate<TVertex, TEdge>)
Removes all edges that match the given predicate
.
Declaration
public int RemoveEdgeIf(EdgePredicate<TVertex, TEdge> predicate)
Parameters
Type | Name | Description |
---|---|---|
EdgePredicate<TVertex, TEdge> | predicate | Predicate to check if an edge should be removed. |
Returns
Type | Description |
---|---|
System.Int32 | The number of edges removed. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Events
| Improve this Doc View SourceEdgeAdded
Fired when an edge is added to this graph.
Declaration
public event EdgeAction<TVertex, TEdge> EdgeAdded
Event Type
Type | Description |
---|---|
EdgeAction<TVertex, TEdge> |
EdgeRemoved
Fired when an edge has been removed from this graph.
Declaration
public event EdgeAction<TVertex, TEdge> EdgeRemoved
Event Type
Type | Description |
---|---|
EdgeAction<TVertex, TEdge> |
Explicit Interface Implementations
| Improve this Doc View SourceICloneable.Clone()
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
System.Object |