anchor.diff:      ///Returns true, since parallel edges are allowed
       member this.AllowParallelEdges :bool =
           true
  -
  -    ///Returns true, if the graph contains the vertex, else false.
  -    member this.ContainsVertex(vertex:'Vertex) :bool =
  -        vertexOutEdges.ContainsKey(vertex)
  -
  -    ///Returns true, if there are no vertices in the graph, else false.
  -    member this.IsVerticesEmpty :bool =
  -        vertexOutEdges.Count = 0
  -
  -    ///Returns the number of vertices of the graph.
  -    member this.VertexCount :int =
  -        vertexOutEdges.Count
  -    
  -    ///Returns the vertices of the graph.
  -    member this.Vertices  =
  -        //for vertices in vertexOutEdges.Keys do
  -        let result = Array.zeroCreate vertexOutEdges.Count
  -        let mutable i = 0
  -        for group in vertexOutEdges do
  -            result.[i] <- group.Key
  -            i <- i+1
  -        result
  -        
  -    ///Returns true, if there are no edges in the graph, else false.
  -    member this.IsEdgesEmpty :bool =
  -        this.EdgeCount = 0
  -        
  +                  
  +    ///Copys the given graph.
  +    member this.Copy() :ArrayAdjacencyGraph<'Vertex,'Label,'Edge> =
  +        let copiedLabels = labels |> Dictionary.copyRecursive id
  +        let newEdges = vertexOutEdges |> Dictionary.copyRecursive Array.copy
  +        ArrayAdjacencyGraph(newEdges,copiedLabels)
  +    
  +    //
  +    //Edges
  +    ///Lookup the first edge in the graph that matches the conditions, returning a Some value if it exists and None if not.
  +    member this.TryGetEdge((source:'Vertex),(target:'Vertex)) :LEdge<'Vertex,'Edge> option =
  +        Dictionary.tryGetValue source vertexOutEdges
  +        |> Option.bind (fun edges ->
  +            edges
  +            |> Array.tryFind (fun (s,t,e) -> s = source && t = target)
  +        )
  +             
  +    ///Return the first edge in the graph that matches the conditions.
  +    member this.GetEdge((source:'Vertex),(target:'Vertex)) :LEdge<'Vertex,'Edge> =
  +        match (this.TryGetEdge(source,target)) with
  +            |Some x -> x
  +            |None   -> failwithf "An edge from vertex %O to vertex %O does not exist in the graph" source target
  +
  +    ///Lookup all edges in the graph that matches the conditions, returning a Some value if it exists and None if not.
  +    member this.TryGetEdges((source:'Vertex),(target:'Vertex)) :LEdge<'Vertex,'Edge> [] option=       
  +        Dictionary.tryGetValue source vertexOutEdges
  +        |> Option.map (fun edges ->
  +            edges
  +            |> Array.filter (fun (s,t,e) -> s = source && t = target)
  +        ) 
  +       
  +    ///Return all edges in the graph that matches the conditions
  +    member this.GetEdges((source:'Vertex),(target:'Vertex)) :LEdge<'Vertex,'Edge> [] =
  +        match (this.TryGetEdges(source,target)) with
  +        |Some x -> x
  +        |None   -> failwithf "An edge from vertex %O to vertex %O does not exist in the graph" source target
  +
       ///Returns all edges of the graph.
  -    member this.Edges =
  +    member this.Edges :LEdge<'Vertex,'Edge>[]=
           let result = Array.zeroCreate vertexOutEdges.Count
           let mutable i = 0
           for group in vertexOutEdges do
  
positive.code:             i <- i+1
          result
          |> Array.concat
          |> Array.distinct
      
      // FGL Functions Edges
      ///Adds a labeled, undirected edge to the graph.
      member this.AddEdge((s, t, w): LEdge<'Vertex,'Edge>) =
          let edgeListSource = 
              match (Dictionary.tryGetValue s vertexOutEdges) with
                  | Some x    -> x |> Array.toList
                  | None      -> failwith "The source vertex of the edge does not exist in this graph."
                    
          let edgeListTarget = 
              match (Dictionary.tryGetValue t vertexOutEdges) with
                  | Some x    -> x |> Array.toList
                  | None      -> failwith "The target vertex of the edge does not exist in this graph."
          
          vertexOutEdges.Item s <- ((s,t,w)::edgeListSource |> Array.ofList)
          vertexOutEdges.Item t <- ((s,t,w)::edgeListTarget |> Array.ofList)
          this
      
      ///Adds a list of labeled, undirected edges to the graph.
      member this.AddManyEdges edgeList=
          for edge in edgeList do
              this.AddEdge edge |> ignore
          
          this
      
      ///Removes an edge from the graph.
      member this.RemoveEdge((s, t, w): LEdge<'Vertex,'Edge>) =
          let edgeListSource = 
              match (Dictionary.tryGetValue s vertexOutEdges) with
                  | Some x    -> x |> Array.filter (fun x -> x <> (s, t, w) )
                  | None      -> failwith "The source vertex of the edge does not exist in this graph."
                    
          let edgeListTarget = 
              match (Dictionary.tryGetValue t vertexOutEdges) with
                  | Some x    -> x |> Array.filter (fun x -> x <> (s, t, w) )
                  | None      -> failwith "The target vertex of the edge does not exist in this graph."
               
          vertexOutEdges.Item s <- (edgeListSource)
          vertexOutEdges.Item t <- (edgeListTarget)
          this
  
      ///Removes a list of edges from the graph.
      member this.RemoveManyEdges edgeList =
          for edge in edgeList do
              this.RemoveEdge edge |> ignore
  
          this
      
      //FGL Functions Vertices
      ///Adds a labeled vertex to the graph.
      member this.AddVertex ((v, l): LVertex<'Vertex,'Label>)=
          (vertexOutEdges.Add (v,[||]))   |> ignore
          (labels.Add (v, l)          )   |> ignore
          this
  
      ///Adds a list of labeled vertices to the graph.    
      member this.AddManyVertices (vertices:list<LVertex<'Vertex,'Label>>) =       
          for vertex in vertices do
              (this.AddVertex vertex) |> ignore
          
          this
  
      ///Removes a vertex from the graph.
      member this.RemoveVertex (v:'Vertex) =       
          (vertexOutEdges.Item v) 
          |> Array.toList 
          |> this.RemoveManyEdges 
          |> ignore
          
          (vertexOutEdges.Remove (v)) |> ignore
          (labels.Remove (v))         |> ignore
          this
  
      ///Removes a list of vertices from the graph.
      member this.RemoveManyVertices nList  =
          for vertex in nList do
              this.RemoveVertex vertex |> ignore
  
          this
      
      ///Returns Some edges if they are neighbours of the vertex, else None.
      member this.TryNeighbours(v:'Vertex) =
          match (this.TryGetConnectedEdges v) with
              | Some x    -> Some(Array.fold (fun folder (s, t, w) -> (s::t::folder)) [] x |> List.distinct)
              | None      -> None
      
      ///Returns the neighbouring edges of the vertex v.
      member this.Neighbours(v:'Vertex) =
          match (this.TryNeighbours (v)) with
              |Some x -> x
              |None   -> failwith "The vertex does not have any neighbours"
  
negative.code: ﻿namespace FSharp.FGL.ArrayAdjacencyGraph
  
  open System.Collections.Generic
  open FSharp.FGL //For our Graph method
  
  //  An immutable directed graph data structure efficient for large sparse
  