Show / Hide Table of Contents

Class EdgeListGraph<TVertex, TEdge>

Mutable edge list graph data structure.

Inheritance
System.Object
EdgeListGraph<TVertex, TEdge>
Implements
IMutableEdgeListGraph<TVertex, TEdge>
IMutableGraph<TVertex, TEdge>
IEdgeListGraph<TVertex, TEdge>
IGraph<TVertex, TEdge>
IEdgeSet<TVertex, TEdge>
IVertexSet<TVertex>
IImplicitVertexSet<TVertex>
System.ICloneable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 Source

EdgeListGraph()

Initializes a new instance of the EdgeListGraph<TVertex, TEdge> class.

Declaration
public EdgeListGraph()
| Improve this Doc View Source

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 Source

AllowParallelEdges

Gets a value indicating if the graph allows parallel edges

Declaration
public bool AllowParallelEdges { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

EdgeCount

Gets the edge count.

Declaration
public int EdgeCount { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Edges

Gets the edges.

Declaration
public IEnumerable<TEdge> Edges { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<TEdge>
| Improve this Doc View Source

IsDirected

Gets a value indicating if the graph is directed

Declaration
public bool IsDirected { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

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
| Improve this Doc View Source

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
| Improve this Doc View Source

VertexCount

Gets the vertex count.

Declaration
public int VertexCount { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Vertices

Gets the vertices.

Declaration
public IEnumerable<TVertex> Vertices { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<TVertex>

Methods

| Improve this Doc View Source

AddEdge(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

edge is null.

| Improve this Doc View Source

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

edges is null or at least one of them is null.

| Improve this Doc View Source

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

edge is null.

| Improve this Doc View Source

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

edges is null or at least one of them is null.

| Improve this Doc View Source

Clear()

Clears the vertex and edges.

Declaration
public void Clear()
| Improve this Doc View Source

Clone()

Clones this graph.

Declaration
public EdgeListGraph<TVertex, TEdge> Clone()
Returns
Type Description
EdgeListGraph<TVertex, TEdge>

Cloned graph.

| Improve this Doc View Source

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 edge is contained in this set, false otherwise.

Exceptions
Type Condition
System.ArgumentNullException

edge is null.

| Improve this Doc View Source

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 vertex is contained in this set, false otherwise.

Exceptions
Type Condition
System.ArgumentNullException

vertex is null.

| Improve this Doc View Source

OnEdgeAdded(TEdge)

Called on each added edge.

Declaration
protected virtual void OnEdgeAdded(TEdge edge)
Parameters
Type Name Description
TEdge edge

Added edge.

| Improve this Doc View Source

OnEdgeRemoved(TEdge)

Called on each removed edge.

Declaration
protected virtual void OnEdgeRemoved(TEdge edge)
Parameters
Type Name Description
TEdge edge

Removed edge.

| Improve this Doc View Source

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 edge was successfully removed, false otherwise.

Exceptions
Type Condition
System.ArgumentNullException

edge is null.

| Improve this Doc View Source

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

predicate is null.

Events

| Improve this Doc View Source

EdgeAdded

Fired when an edge is added to this graph.

Declaration
public event EdgeAction<TVertex, TEdge> EdgeAdded
Event Type
Type Description
EdgeAction<TVertex, TEdge>
| Improve this Doc View Source

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 Source

ICloneable.Clone()

Declaration
object ICloneable.Clone()
Returns
Type Description
System.Object

Implements

IMutableEdgeListGraph<TVertex, TEdge>
IMutableGraph<TVertex, TEdge>
IEdgeListGraph<TVertex, TEdge>
IGraph<TVertex, TEdge>
IEdgeSet<TVertex, TEdge>
IVertexSet<TVertex>
IImplicitVertexSet<TVertex>
System.ICloneable

Extension Methods

GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, XmlReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, String, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeAndValidateFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
SerializationExtensions.SerializeToBinary<TVertex, TEdge>(IGraph<TVertex, TEdge>, Stream)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String, Action<XmlWriter, TGraph>, Action<XmlWriter, TVertex>, Action<XmlWriter, TEdge>)
AlgorithmExtensions.GetVertexIdentity<TVertex>(IVertexSet<TVertex>)
AlgorithmExtensions.GetEdgeIdentity<TVertex, TEdge>(IEdgeSet<TVertex, TEdge>)
AlgorithmExtensions.ComputeTransitiveReduction<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>)
AlgorithmExtensions.ComputeTransitiveClosure<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>, Func<TVertex, TVertex, TEdge>)
GraphvizExtensions.ToGraphviz<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>)
GraphvizExtensions.ToGraphviz<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>, Action<GraphvizAlgorithm<TVertex, TEdge>>)
GraphvizExtensions.ToSvg<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>)
GraphvizExtensions.ToSvg<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>, Action<GraphvizAlgorithm<TVertex, TEdge>>)
MsaglGraphExtensions.CreateMsaglPopulator<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>)
MsaglGraphExtensions.CreateMsaglPopulator<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>, String, IFormatProvider)
MsaglGraphExtensions.CreateMsaglPopulator<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>, VertexIdentity<TVertex>)
MsaglGraphExtensions.ToMsaglGraph<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>, MsaglVertexNodeEventHandler<TVertex>, MsaglEdgeEventHandler<TVertex, TEdge>)
MsaglGraphExtensions.ToMsaglGraph<TVertex, TEdge>(IEdgeListGraph<TVertex, TEdge>, VertexIdentity<TVertex>, MsaglVertexNodeEventHandler<TVertex>, MsaglEdgeEventHandler<TVertex, TEdge>)
  • Improve this Doc
  • View Source
In This Article
Back to top QuikGraph