Exemplo n.º 1
0
 public static TNewGraph Convert <TOldVertex, TOldEdge, TNewGraph>(
     this IVertexAndEdgeListGraph <TOldVertex, TOldEdge> oldGraph,
     TNewGraph newGraph)
     where TOldEdge : IEdge <TOldVertex>
     where TNewGraph : IMutableVertexAndEdgeListGraph <TOldVertex, TOldEdge>
 {
     return(oldGraph.Convert <TOldVertex, TOldEdge, TOldVertex, TOldEdge, TNewGraph>(newGraph, null, null));
 }
Exemplo n.º 2
0
 public static BidirectionalGraph <TOldVertex, TNewEdge> Convert <TOldVertex, TOldEdge, TNewEdge>(
     this IVertexAndEdgeListGraph <TOldVertex, TOldEdge> oldGraph,
     Func <TOldEdge, TNewEdge> edgeMapperFunc)
     where TOldEdge : IEdge <TOldVertex>
     where TNewEdge : IEdge <TOldVertex>
 {
     return(oldGraph.Convert <TOldVertex, TOldEdge, TOldVertex, TNewEdge>(null, edgeMapperFunc));
 }
Exemplo n.º 3
0
 public static BidirectionalGraph <TVertex, TNewEdge> Convert <TVertex, TOldEdge, TNewEdge>(
     [NotNull] this IVertexAndEdgeListGraph <TVertex, TOldEdge> oldGraph,
     [CanBeNull, InstantHandle] Func <TOldEdge, TNewEdge> edgeConverter)
     where TOldEdge : IEdge <TVertex>
     where TNewEdge : IEdge <TVertex>
 {
     return(oldGraph.Convert <TVertex, TOldEdge, TVertex, TNewEdge>(
                null,
                edgeConverter));
 }
Exemplo n.º 4
0
 public static TNewGraph Convert <TVertex, TEdge, TNewGraph>(
     [NotNull] this IVertexAndEdgeListGraph <TVertex, TEdge> oldGraph,
     [NotNull] TNewGraph newGraph)
     where TEdge : IEdge <TVertex>
     where TNewGraph : IMutableVertexAndEdgeListGraph <TVertex, TEdge>
 {
     return(oldGraph.Convert <TVertex, TEdge, TVertex, TEdge, TNewGraph>(
                newGraph,
                null,
                null));
 }
Exemplo n.º 5
0
 public static BidirectionalGraph <TNewVertex, TNewEdge> Convert <TOldVertex, TOldEdge, TNewVertex, TNewEdge>(
     this IVertexAndEdgeListGraph <TOldVertex, TOldEdge> oldGraph,
     Func <TOldVertex, TNewVertex> vertexMapperFunc,
     Func <TOldEdge, TNewEdge> edgeMapperFunc)
     where TOldEdge : IEdge <TOldVertex>
     where TNewEdge : IEdge <TNewVertex>
 {
     return(oldGraph.Convert(
                new BidirectionalGraph <TNewVertex, TNewEdge>(oldGraph.AllowParallelEdges, oldGraph.VertexCount),
                vertexMapperFunc,
                edgeMapperFunc));
 }
Exemplo n.º 6
0
        public static TNewGraph Convert <TOldVertex, TOldEdge, TNewEdge, TNewGraph>(
            this IVertexAndEdgeListGraph <TOldVertex, TOldEdge> oldGraph,
            TNewGraph newGraph,
            Func <TOldEdge, TNewEdge> edgeMapperFunc)
            where TOldEdge : IEdge <TOldVertex>
            where TNewEdge : IEdge <TOldVertex>
            where TNewGraph : IMutableVertexAndEdgeListGraph <TOldVertex, TNewEdge>
        {
            Contract.Requires(oldGraph != null);

            return(oldGraph.Convert <TOldVertex, TOldEdge, TOldVertex, TNewEdge, TNewGraph>(newGraph, null, edgeMapperFunc));
        }
Exemplo n.º 7
0
 public static TNewGraph Convert <TVertex, TOldEdge, TNewEdge, TNewGraph>(
     [NotNull] this IVertexAndEdgeListGraph <TVertex, TOldEdge> oldGraph,
     [NotNull] TNewGraph newGraph,
     [CanBeNull, InstantHandle] Func <TOldEdge, TNewEdge> edgeConverter)
     where TOldEdge : IEdge <TVertex>
     where TNewEdge : IEdge <TVertex>
     where TNewGraph : IMutableVertexAndEdgeListGraph <TVertex, TNewEdge>
 {
     return(oldGraph.Convert <TVertex, TOldEdge, TVertex, TNewEdge, TNewGraph>(
                newGraph,
                null,
                edgeConverter));
 }
Exemplo n.º 8
0
 public static BidirectionalGraph <TNewVertex, TNewEdge> Convert <TOldVertex, TOldEdge, TNewVertex, TNewEdge>(
     [NotNull] this IVertexAndEdgeListGraph <TOldVertex, TOldEdge> oldGraph,
     [CanBeNull, InstantHandle] Func <TOldVertex, TNewVertex> vertexConverter,
     [CanBeNull, InstantHandle] Func <TOldEdge, TNewEdge> edgeConverter)
     where TOldEdge : IEdge <TOldVertex>
     where TNewEdge : IEdge <TNewVertex>
 {
     if (oldGraph is null)
     {
         throw new ArgumentNullException(nameof(oldGraph));
     }
     return(oldGraph.Convert(
                new BidirectionalGraph <TNewVertex, TNewEdge>(oldGraph.AllowParallelEdges, oldGraph.VertexCount),
                vertexConverter,
                edgeConverter));
 }