Class GraphExtensions
Extensions for populating graph data structures.
Inheritance
Inherited Members
Namespace: QuikGraph
Assembly: QuikGraph.dll
Syntax
public static class GraphExtensions
Methods
| Improve this Doc View SourceToAdjacencyGraph<TVertex>(TVertex[][])
Converts a raw array of sources and targets (2 columns) vertices into a graph.
Declaration
public static AdjacencyGraph<TVertex, SEquatableEdge<TVertex>> ToAdjacencyGraph<TVertex>(this TVertex[][] edges)
Parameters
Type | Name | Description |
---|---|---|
TVertex[][] | edges | Array of vertices defining edges. The first items of each column represents the number of vertices following. |
Returns
Type | Description |
---|---|
AdjacencyGraph<TVertex, SEquatableEdge<TVertex>> | A corresponding AdjacencyGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
System.ArgumentException |
|
ToAdjacencyGraph<TVertex>(IEnumerable<SEquatableEdge<TVertex>>)
Converts a set of vertex pairs into an AdjacencyGraph<TVertex, TEdge>.
Declaration
public static AdjacencyGraph<TVertex, SEquatableEdge<TVertex>> ToAdjacencyGraph<TVertex>(this IEnumerable<SEquatableEdge<TVertex>> vertexPairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | vertexPairs | Set of vertex pairs to convert. |
Returns
Type | Description |
---|---|
AdjacencyGraph<TVertex, SEquatableEdge<TVertex>> | A corresponding AdjacencyGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToAdjacencyGraph<TVertex, TEdge>(IEnumerable<TVertex>, Func<TVertex, IEnumerable<TEdge>>, Boolean)
Converts a set of vertices into an AdjacencyGraph<TVertex, TEdge> using an edge factory.
Declaration
public static AdjacencyGraph<TVertex, TEdge> ToAdjacencyGraph<TVertex, TEdge>(this IEnumerable<TVertex> vertices, Func<TVertex, IEnumerable<TEdge>> outEdgesFactory, bool allowParallelEdges = true)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TVertex> | vertices | Set of vertices to convert. |
System.Func<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | outEdgesFactory | The out edges factory. |
System.Boolean | allowParallelEdges | Indicates if parallel edges are allowed. |
Returns
Type | Description |
---|---|
AdjacencyGraph<TVertex, TEdge> | A corresponding AdjacencyGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToAdjacencyGraph<TVertex, TEdge>(IEnumerable<TEdge>, Boolean)
Converts a set of edges into an AdjacencyGraph<TVertex, TEdge>.
Declaration
public static AdjacencyGraph<TVertex, TEdge> ToAdjacencyGraph<TVertex, TEdge>(this IEnumerable<TEdge> edges, bool allowParallelEdges = true)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TEdge> | edges | Set of edges to convert. |
System.Boolean | allowParallelEdges | Indicates if parallel edges are allowed. |
Returns
Type | Description |
---|---|
AdjacencyGraph<TVertex, TEdge> | A corresponding AdjacencyGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToArrayAdjacencyGraph<TVertex, TEdge>(IVertexAndEdgeListGraph<TVertex, TEdge>)
Creates an immutable ArrayAdjacencyGraph<TVertex, TEdge> from the input graph.
Declaration
public static ArrayAdjacencyGraph<TVertex, TEdge> ToArrayAdjacencyGraph<TVertex, TEdge>(this IVertexAndEdgeListGraph<TVertex, TEdge> graph)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
IVertexAndEdgeListGraph<TVertex, TEdge> | graph | Graph to convert. |
Returns
Type | Description |
---|---|
ArrayAdjacencyGraph<TVertex, TEdge> | A corresponding ArrayAdjacencyGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToArrayBidirectionalGraph<TVertex, TEdge>(IBidirectionalGraph<TVertex, TEdge>)
Creates an immutable ArrayBidirectionalGraph<TVertex, TEdge> from the input graph.
Declaration
public static ArrayBidirectionalGraph<TVertex, TEdge> ToArrayBidirectionalGraph<TVertex, TEdge>(this IBidirectionalGraph<TVertex, TEdge> graph)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
IBidirectionalGraph<TVertex, TEdge> | graph | Graph to convert. |
Returns
Type | Description |
---|---|
ArrayBidirectionalGraph<TVertex, TEdge> | A corresponding ArrayBidirectionalGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToArrayUndirectedGraph<TVertex, TEdge>(IUndirectedGraph<TVertex, TEdge>)
Creates an immutable ArrayUndirectedGraph<TVertex, TEdge> from the input graph.
Declaration
public static ArrayUndirectedGraph<TVertex, TEdge> ToArrayUndirectedGraph<TVertex, TEdge>(this IUndirectedGraph<TVertex, TEdge> graph)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
IUndirectedGraph<TVertex, TEdge> | graph | Graph to convert. |
Returns
Type | Description |
---|---|
ArrayUndirectedGraph<TVertex, TEdge> | A corresponding ArrayUndirectedGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToBidirectionalGraph<TVertex>(IEnumerable<SEquatableEdge<TVertex>>)
Converts a set of vertex pairs into a BidirectionalGraph<TVertex, TEdge>.
Declaration
public static BidirectionalGraph<TVertex, SEquatableEdge<TVertex>> ToBidirectionalGraph<TVertex>(this IEnumerable<SEquatableEdge<TVertex>> vertexPairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | vertexPairs | Set of vertex pairs to convert. |
Returns
Type | Description |
---|---|
BidirectionalGraph<TVertex, SEquatableEdge<TVertex>> | A corresponding BidirectionalGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToBidirectionalGraph<TVertex, TEdge>(IUndirectedGraph<TVertex, TEdge>)
Creates a BidirectionalGraph<TVertex, TEdge> from this graph.
Declaration
public static BidirectionalGraph<TVertex, TEdge> ToBidirectionalGraph<TVertex, TEdge>(this IUndirectedGraph<TVertex, TEdge> graph)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
IUndirectedGraph<TVertex, TEdge> | graph | Graph to convert. |
Returns
Type | Description |
---|---|
BidirectionalGraph<TVertex, TEdge> | A corresponding BidirectionalGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | |
TEdge |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToBidirectionalGraph<TVertex, TEdge>(IVertexAndEdgeListGraph<TVertex, TEdge>)
Wraps a graph (out-edges only) into a bidirectional graph.
Declaration
public static IBidirectionalGraph<TVertex, TEdge> ToBidirectionalGraph<TVertex, TEdge>(this IVertexAndEdgeListGraph<TVertex, TEdge> graph)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
IVertexAndEdgeListGraph<TVertex, TEdge> | graph | Graph to convert. |
Returns
Type | Description |
---|---|
IBidirectionalGraph<TVertex, TEdge> | A corresponding IBidirectionalGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Remarks
For already bidirectional graph it returns itself.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToBidirectionalGraph<TVertex, TEdge>(IEnumerable<TVertex>, Func<TVertex, IEnumerable<TEdge>>, Boolean)
Converts a set of vertices into a BidirectionalGraph<TVertex, TEdge> using an edge factory.
Declaration
public static BidirectionalGraph<TVertex, TEdge> ToBidirectionalGraph<TVertex, TEdge>(this IEnumerable<TVertex> vertices, Func<TVertex, IEnumerable<TEdge>> outEdgesFactory, bool allowParallelEdges = true)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TVertex> | vertices | Set of vertices to convert. |
System.Func<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | outEdgesFactory | The out edges factory. |
System.Boolean | allowParallelEdges | Indicates if parallel edges are allowed. |
Returns
Type | Description |
---|---|
BidirectionalGraph<TVertex, TEdge> | A corresponding BidirectionalGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToBidirectionalGraph<TVertex, TEdge>(IEnumerable<TEdge>, Boolean)
Converts a set of edges into a BidirectionalGraph<TVertex, TEdge>.
Declaration
public static BidirectionalGraph<TVertex, TEdge> ToBidirectionalGraph<TVertex, TEdge>(this IEnumerable<TEdge> edges, bool allowParallelEdges = true)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TEdge> | edges | Set of edges to convert. |
System.Boolean | allowParallelEdges | Indicates if parallel edges are allowed. |
Returns
Type | Description |
---|---|
BidirectionalGraph<TVertex, TEdge> | A corresponding BidirectionalGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToCompressedRowGraph<TVertex, TEdge>(IVertexAndEdgeListGraph<TVertex, TEdge>)
Creates an immutable compressed row graph representation of the graph
.
Declaration
public static CompressedSparseRowGraph<TVertex> ToCompressedRowGraph<TVertex, TEdge>(this IVertexAndEdgeListGraph<TVertex, TEdge> graph)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
IVertexAndEdgeListGraph<TVertex, TEdge> | graph | Graph to visit. |
Returns
Type | Description |
---|---|
CompressedSparseRowGraph<TVertex> | A corresponding CompressedSparseRowGraph<TVertex>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToDelegateBidirectionalIncidenceGraph<TVertex, TEdge>(TryFunc<TVertex, IEnumerable<TEdge>>, TryFunc<TVertex, IEnumerable<TEdge>>)
Creates an instance of DelegateBidirectionalIncidenceGraph<TVertex, TEdge> from these getters of edges.
Declaration
public static DelegateBidirectionalIncidenceGraph<TVertex, TEdge> ToDelegateBidirectionalIncidenceGraph<TVertex, TEdge>(this TryFunc<TVertex, IEnumerable<TEdge>> tryGetOutEdges, TryFunc<TVertex, IEnumerable<TEdge>> tryGetInEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
TryFunc<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | tryGetOutEdges | Getter of out-edges. |
TryFunc<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | tryGetInEdges | Getter of in-edges. |
Returns
Type | Description |
---|---|
DelegateBidirectionalIncidenceGraph<TVertex, TEdge> | A corresponding DelegateBidirectionalIncidenceGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToDelegateIncidenceGraph<TVertex, TEdge>(TryFunc<TVertex, IEnumerable<TEdge>>)
Creates an instance of DelegateIncidenceGraph<TVertex, TEdge> from this getter of out-edges.
Declaration
public static DelegateIncidenceGraph<TVertex, TEdge> ToDelegateIncidenceGraph<TVertex, TEdge>(this TryFunc<TVertex, IEnumerable<TEdge>> tryGetOutEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
TryFunc<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | tryGetOutEdges | Getter of out-edges. |
Returns
Type | Description |
---|---|
DelegateIncidenceGraph<TVertex, TEdge> | A corresponding DelegateIncidenceGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToDelegateIncidenceGraph<TVertex, TEdge>(Func<TVertex, IEnumerable<TEdge>>)
Creates an instance of DelegateIncidenceGraph<TVertex, TEdge> from this getter of out-edges.
Declaration
public static DelegateIncidenceGraph<TVertex, TEdge> ToDelegateIncidenceGraph<TVertex, TEdge>(this Func<TVertex, IEnumerable<TEdge>> getOutEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Func<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | getOutEdges | Getter of out-edges. |
Returns
Type | Description |
---|---|
DelegateIncidenceGraph<TVertex, TEdge> | A corresponding DelegateIncidenceGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToDelegateUndirectedGraph<TVertex, TEdge>(IEnumerable<TVertex>, TryFunc<TVertex, IEnumerable<TEdge>>)
Creates an instance of DelegateUndirectedGraph<TVertex, TEdge> from given vertices and edge getter.
Declaration
public static DelegateUndirectedGraph<TVertex, TEdge> ToDelegateUndirectedGraph<TVertex, TEdge>(this IEnumerable<TVertex> vertices, TryFunc<TVertex, IEnumerable<TEdge>> tryGetAdjacentEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TVertex> | vertices | Enumerable of vertices. |
TryFunc<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | tryGetAdjacentEdges | Getter of adjacent edges. |
Returns
Type | Description |
---|---|
DelegateUndirectedGraph<TVertex, TEdge> | A corresponding DelegateUndirectedGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToDelegateUndirectedGraph<TVertex, TEdge>(IEnumerable<TVertex>, Func<TVertex, IEnumerable<TEdge>>)
Creates an instance of DelegateUndirectedGraph<TVertex, TEdge> from given vertices and edge getter.
Declaration
public static DelegateUndirectedGraph<TVertex, TEdge> ToDelegateUndirectedGraph<TVertex, TEdge>(this IEnumerable<TVertex> vertices, Func<TVertex, IEnumerable<TEdge>> getAdjacentEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TVertex> | vertices | Enumerable of vertices. |
System.Func<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | getAdjacentEdges | Getter of adjacent edges. |
Returns
Type | Description |
---|---|
DelegateUndirectedGraph<TVertex, TEdge> | A corresponding DelegateUndirectedGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToDelegateVertexAndEdgeListGraph<TVertex, TEdge>(IEnumerable<TVertex>, TryFunc<TVertex, IEnumerable<TEdge>>)
Creates an instance of DelegateVertexAndEdgeListGraph<TVertex, TEdge> from given vertices and edge try getter.
Declaration
public static DelegateVertexAndEdgeListGraph<TVertex, TEdge> ToDelegateVertexAndEdgeListGraph<TVertex, TEdge>(this IEnumerable<TVertex> vertices, TryFunc<TVertex, IEnumerable<TEdge>> tryGetOutEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TVertex> | vertices | Enumerable of vertices. |
TryFunc<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | tryGetOutEdges | Getter of out-edges. |
Returns
Type | Description |
---|---|
DelegateVertexAndEdgeListGraph<TVertex, TEdge> | A corresponding DelegateVertexAndEdgeListGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToDelegateVertexAndEdgeListGraph<TVertex, TEdge>(IEnumerable<TVertex>, Func<TVertex, IEnumerable<TEdge>>)
Creates an instance of DelegateVertexAndEdgeListGraph<TVertex, TEdge> from given vertices and edge getter.
Declaration
public static DelegateVertexAndEdgeListGraph<TVertex, TEdge> ToDelegateVertexAndEdgeListGraph<TVertex, TEdge>(this IEnumerable<TVertex> vertices, Func<TVertex, IEnumerable<TEdge>> getOutEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TVertex> | vertices | Enumerable of vertices. |
System.Func<TVertex, System.Collections.Generic.IEnumerable<TEdge>> | getOutEdges | Getter of out-edges. |
Returns
Type | Description |
---|---|
DelegateVertexAndEdgeListGraph<TVertex, TEdge> | A corresponding DelegateVertexAndEdgeListGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToDelegateVertexAndEdgeListGraph<TVertex, TEdge, TEdges>(IDictionary<TVertex, TEdges>)
Wraps a dictionary into a vertex and edge list graph.
Declaration
public static DelegateVertexAndEdgeListGraph<TVertex, TEdge> ToDelegateVertexAndEdgeListGraph<TVertex, TEdge, TEdges>(this IDictionary<TVertex, TEdges> dictionary)
where TEdge : IEdge<TVertex> where TEdges : IEnumerable<TEdge>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TVertex, TEdges> | dictionary | Vertices and edges mapping. |
Returns
Type | Description |
---|---|
DelegateVertexAndEdgeListGraph<TVertex, TEdge> | A corresponding DelegateVertexAndEdgeListGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
TEdges | Type of the enumerable of out-edges. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToDelegateVertexAndEdgeListGraph<TVertex, TEdge, TValue>(IDictionary<TVertex, TValue>, Converter<KeyValuePair<TVertex, TValue>, IEnumerable<TEdge>>)
Wraps a dictionary into a DelegateVertexAndEdgeListGraph<TVertex, TEdge> with the given edge conversion to get edges.
Declaration
public static DelegateVertexAndEdgeListGraph<TVertex, TEdge> ToDelegateVertexAndEdgeListGraph<TVertex, TEdge, TValue>(this IDictionary<TVertex, TValue> dictionary, Converter<KeyValuePair<TVertex, TValue>, IEnumerable<TEdge>> keyValueToOutEdges)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TVertex, TValue> | dictionary | Vertices and edges mapping. |
System.Converter<System.Collections.Generic.KeyValuePair<TVertex, TValue>, System.Collections.Generic.IEnumerable<TEdge>> | keyValueToOutEdges | Converter of vertex/edge mapping to enumerable of edges. |
Returns
Type | Description |
---|---|
DelegateVertexAndEdgeListGraph<TVertex, TEdge> | A corresponding DelegateVertexAndEdgeListGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
TValue | Type of the enumerable of out-edges. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
ToUndirectedGraph<TVertex>(IEnumerable<SEquatableEdge<TVertex>>)
Converts a set of vertex pairs into an UndirectedGraph<TVertex, TEdge>.
Declaration
public static UndirectedGraph<TVertex, SEquatableEdge<TVertex>> ToUndirectedGraph<TVertex>(this IEnumerable<SEquatableEdge<TVertex>> vertexPairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<SEquatableEdge<TVertex>> | vertexPairs | Set of vertex pairs to convert. |
Returns
Type | Description |
---|---|
UndirectedGraph<TVertex, SEquatableEdge<TVertex>> | A corresponding UndirectedGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ToUndirectedGraph<TVertex, TEdge>(IEnumerable<TEdge>, Boolean)
Converts a sequence of edges into an UndirectedGraph<TVertex, TEdge>.
Declaration
public static UndirectedGraph<TVertex, TEdge> ToUndirectedGraph<TVertex, TEdge>(this IEnumerable<TEdge> edges, bool allowParallelEdges = true)
where TEdge : IEdge<TVertex>
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TEdge> | edges | Set of edges to convert. |
System.Boolean | allowParallelEdges | Indicates if parallel edges are allowed. |
Returns
Type | Description |
---|---|
UndirectedGraph<TVertex, TEdge> | A corresponding UndirectedGraph<TVertex, TEdge>. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|