Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into refactor_expect_sim…
Browse files Browse the repository at this point in the history
…plified
  • Loading branch information
JoeyT1994 committed Apr 24, 2024
2 parents 4933a12 + c0621b7 commit 7c11951
Show file tree
Hide file tree
Showing 86 changed files with 926 additions and 1,134 deletions.
1 change: 0 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
fail-fast: false
matrix:
version:
- '1.7'
- '1'
os:
- ubuntu-latest
Expand Down
30 changes: 18 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ITensorNetworks"
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"]
version = "0.8.1"
version = "0.10.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -13,19 +13,16 @@ Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
IsApprox = "28f27b66-4bd8-47e7-9110-e2746eb8bed7"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"
Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SerializedElementArrays = "d3ce8812-9567-47e9-a7b5-65a6d70a3065"
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2"
Expand All @@ -38,44 +35,53 @@ TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"

[weakdeps]
EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5"
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889"
Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0"
OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715"

[extensions]
ITensorNetworksEinExprsExt = "EinExprs"
ITensorNetworksGraphsFlowsExt = "GraphsFlows"
ITensorNetworksObserversExt = "Observers"
ITensorNetworksOMEinsumContractionOrdersExt = "OMEinsumContractionOrders"

[compat]
AbstractTrees = "0.4.4"
Combinatorics = "1"
Compat = "3, 4"
DataGraphs = "0.1.13"
DataGraphs = "0.2.2"
DataStructures = "0.18"
Dictionaries = "0.4"
Distributions = "0.25.86"
DocStringExtensions = "0.8, 0.9"
DocStringExtensions = "0.9"
EinExprs = "0.6.4"
Graphs = "1.8"
GraphsFlows = "0.1.1"
ITensors = "0.3.58"
ITensors = "0.4"
IsApprox = "0.1"
IterTools = "1.4.0"
KrylovKit = "0.6, 0.7"
NamedGraphs = "0.1.23"
NDTensors = "0.2, 0.3"
NamedGraphs = "0.5.1"
NDTensors = "0.3"
Observers = "0.2"
OMEinsumContractionOrders = "0.8.3"
PackageExtensionCompat = "1"
Requires = "1.3"
SerializedElementArrays = "0.1"
SimpleTraits = "0.9"
SparseArrayKit = "0.2.1, 0.3"
SparseArrayKit = "0.3"
SplitApplyCombine = "1.2"
StaticArrays = "1.5.12"
StructWalk = "0.2"
Suppressor = "0.2"
TimerOutputs = "0.5.22"
TupleTools = "1.4"
julia = "1.7"
julia = "1.10"

[extras]
EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5"
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889"
Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0"
OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
Expand Down
62 changes: 32 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ julia> ] add ITensorNetworks
Here are is an example of making a tensor network on a chain graph (a tensor train or matrix product state):

```julia
julia> using Graphs: neighbors
julia> using Graphs: neighbors, path_graph

julia> using ITensorNetworks: ITensorNetwork, siteinds
julia> using ITensorNetworks: ITensorNetwork

julia> using NamedGraphs: named_grid, subgraph

julia> tn = ITensorNetwork(named_grid(4); link_space=2)
julia> tn = ITensorNetwork(path_graph(4); link_space=2)
ITensorNetworks.ITensorNetwork{Int64} with 4 vertices:
4-element Vector{Int64}:
4-element Dictionaries.Indices{Int64}
1
2
3
Expand Down Expand Up @@ -89,9 +87,13 @@ julia> neighbors(tn, 4)
and here is a similar example for making a tensor network on a grid (a tensor product state or project entangled pair state (PEPS)):

```julia
julia> using NamedGraphs.GraphsExtensions: subgraph

julia> using NamedGraphs.NamedGraphGenerators: named_grid

julia> tn = ITensorNetwork(named_grid((2, 2)); link_space=2)
ITensorNetworks.ITensorNetwork{Tuple{Int64, Int64}} with 4 vertices:
4-element Vector{Tuple{Int64, Int64}}:
4-element Dictionaries.Indices{Tuple{Int64, Int64}}
(1, 1)
(2, 1)
(1, 2)
Expand Down Expand Up @@ -126,7 +128,7 @@ julia> neighbors(tn, (1, 2))

julia> tn_1 = subgraph(v -> v[1] == 1, tn)
ITensorNetworks.ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
2-element Vector{Tuple{Int64, Int64}}:
2-element Dictionaries.Indices{Tuple{Int64, Int64}}
(1, 1)
(1, 2)

Expand All @@ -140,7 +142,7 @@ with vertex data:

julia> tn_2 = subgraph(v -> v[1] == 2, tn)
ITensorNetworks.ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
2-element Vector{Tuple{Int64, Int64}}:
2-element Dictionaries.Indices{Tuple{Int64, Int64}}
(2, 1)
(2, 2)

Expand All @@ -159,13 +161,13 @@ Networks can also be merged/unioned:
```julia
julia> using ITensors: prime

julia> using ITensorNetworks: , contract, contraction_sequence
julia> using ITensorNetworks: , contract, contraction_sequence, siteinds

julia> using ITensorUnicodePlots: @visualize

julia> s = siteinds("S=1/2", named_grid(3))
ITensorNetworks.IndsNetwork{Int64, ITensors.Index} with 3 vertices:
3-element Vector{Int64}:
3-element Dictionaries.Indices{Int64}
1
2
3
Expand All @@ -185,7 +187,7 @@ and edge data:

julia> tn1 = ITensorNetwork(s; link_space=2)
ITensorNetworks.ITensorNetwork{Int64} with 3 vertices:
3-element Vector{Int64}:
3-element Dictionaries.Indices{Int64}
1
2
3
Expand All @@ -202,7 +204,7 @@ with vertex data:
julia> tn2 = ITensorNetwork(s; link_space=2)
ITensorNetworks.ITensorNetwork{Int64} with 3 vertices:
3-element Vector{Int64}:
3-element Dictionaries.Indices{Int64}
1
2
3
Expand Down Expand Up @@ -293,8 +295,8 @@ julia> @visualize Z;

julia> contraction_sequence(Z)
2-element Vector{Vector}:
NamedGraphs.Key{Tuple{Int64, Int64}}[Key((1, 1)), Key((1, 2))]
Any[Key((2, 1)), Any[Key((2, 2)), NamedGraphs.Key{Tuple{Int64, Int64}}[Key((3, 1)), Key((3, 2))]]]
NamedGraphs.Keys.Key{Tuple{Int64, Int64}}[Key((1, 1)), Key((1, 2))]
Any[Key((2, 1)), Any[Key((2, 2)), NamedGraphs.Keys.Key{Tuple{Int64, Int64}}[Key((3, 1)), Key((3, 2))]]]

julia>= contract(Z, (1, 1) => (2, 1));

Expand All @@ -303,20 +305,20 @@ julia> @visualize Z̃;
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(2, 1)⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(2)'⠤⠤⠔⠒⠒⠉⠉⠀⠀⢱⠀⠈⠉⠑⠒⠢⠤⢄⣀2⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠤⠔⠒⠊⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠒⠒⠤⠤⢄⣀⡀⠀⠀⠀⠀⠀
(3, 1)⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Z̃(1, 2)⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀2⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠2⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⡠⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀2⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⢀⠤⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(2, 2)⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡠⠤⠒⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤2⠒⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⣀⡠⠤⠒⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀(3, 2)⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(3, 1)⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠉⠉⠑⠒⠒⠢⠤⠤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈2⠉⠑⠒⠒⠤⠤⠤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀(2)'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(3, 2)⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀2⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
(2, 1)⠤⠤⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠑⠒2⠢⠤⠤⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⣀⠔⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉(2, 2)⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀2⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⠤⠒⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡠⠤2⠒⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢱⠀⢀⣀⠤⠔⠒⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀Z̃(1, 2)⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Expand All @@ -328,7 +330,7 @@ julia> @visualize Z̃;
This file was generated with [weave.jl](https://github.com/JunoLab/Weave.jl) with the following commands:
This file was generated with [Weave.jl](https://github.com/JunoLab/Weave.jl) with the following commands:
```julia
using ITensorNetworks: ITensorNetworks
Expand Down
13 changes: 7 additions & 6 deletions examples/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ Random.seed!(ITensors.index_id_rng(), 1234);
#' Here are is an example of making a tensor network on a chain graph (a tensor train or matrix product state):
#+ term=true

using Graphs: neighbors
using ITensorNetworks: ITensorNetwork, siteinds
using NamedGraphs: named_grid, subgraph
tn = ITensorNetwork(named_grid(4); link_space=2)
using Graphs: neighbors, path_graph
using ITensorNetworks: ITensorNetwork
tn = ITensorNetwork(path_graph(4); link_space=2)
tn[1]
tn[2]
neighbors(tn, 1)
Expand All @@ -46,6 +45,8 @@ neighbors(tn, 4)
#' and here is a similar example for making a tensor network on a grid (a tensor product state or project entangled pair state (PEPS)):
#+ term=true

using NamedGraphs.GraphsExtensions: subgraph
using NamedGraphs.NamedGraphGenerators: named_grid
tn = ITensorNetwork(named_grid((2, 2)); link_space=2)
tn[1, 1]
neighbors(tn, (1, 1))
Expand All @@ -57,7 +58,7 @@ tn_2 = subgraph(v -> v[1] == 2, tn)
#+ term=true

using ITensors: prime
using ITensorNetworks: , contract, contraction_sequence
using ITensorNetworks: , contract, contraction_sequence, siteinds
using ITensorUnicodePlots: @visualize
s = siteinds("S=1/2", named_grid(3))
tn1 = ITensorNetwork(s; link_space=2)
Expand All @@ -72,7 +73,7 @@ Z̃ = contract(Z, (1, 1) => (2, 1));

#' ## Generating this README

#' This file was generated with [weave.jl](https://github.com/JunoLab/Weave.jl) with the following commands:
#' This file was generated with [Weave.jl](https://github.com/JunoLab/Weave.jl) with the following commands:
#+ eval=false

using ITensorNetworks: ITensorNetworks
Expand Down
19 changes: 19 additions & 0 deletions ext/ITensorNetworksGraphsFlowsExt/ITensorNetworksGraphsFlowsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module ITensorNetworksGraphsFlowsExt
using Graphs: AbstractGraph
using GraphsFlows: GraphsFlows
using ITensorNetworks: ITensorNetworks
using NDTensors.AlgorithmSelection: @Algorithm_str

function ITensorNetworks.mincut(
::Algorithm"GraphsFlows",
graph::AbstractGraph,
source_vertex,
target_vertex;
capacity_matrix,
alg=GraphsFlows.PushRelabelAlgorithm(),
)
# TODO: Replace with `Backend(backend)`.
return GraphsFlows.mincut(graph, source_vertex, target_vertex, capacity_matrix, alg)
end

end
Loading

0 comments on commit 7c11951

Please sign in to comment.