Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
47598e3
Fix ambiguity on steiner_tree
JoeyT1994 Nov 7, 2024
8da3920
Merge remote-tracking branch 'origin/main'
JoeyT1994 Nov 7, 2024
dda7376
Merge remote-tracking branch 'origin/main'
JoeyT1994 Dec 18, 2024
c9eca8b
Merge remote-tracking branch 'origin/main'
JoeyT1994 Mar 26, 2025
6d09f22
Cycle functionality
JoeyT1994 Mar 27, 2025
1ef54b1
Function name
JoeyT1994 Mar 27, 2025
e752b67
Update src/simplecycles.jl
JoeyT1994 Mar 31, 2025
ea33311
Update src/simplecycles.jl
JoeyT1994 Mar 31, 2025
29e6f12
Update src/simplecycles.jl
JoeyT1994 Mar 31, 2025
4f5e29f
Update src/simplecycles.jl
JoeyT1994 Mar 31, 2025
a523800
Remove redundant arg
JoeyT1994 Mar 31, 2025
bd8a133
Merge remote-tracking branch 'origin/main'
JoeyT1994 Apr 25, 2025
4a632c6
Merge remote-tracking branch 'origin/main'
JoeyT1994 Sep 24, 2025
03f4de9
PartitionedGraphView
JoeyT1994 Sep 24, 2025
51c71f9
Version bump
JoeyT1994 Sep 24, 2025
2386b44
Abstruct subtype. Fix toml
JoeyT1994 Sep 24, 2025
668e6dc
Fix toml again
JoeyT1994 Sep 24, 2025
b7e71aa
Fix toml again
JoeyT1994 Sep 24, 2025
4d37a3c
Update src/lib/PartitionedGraphs/src/partitionedgraphview.jl
JoeyT1994 Sep 26, 2025
7083dcb
Refactor
JoeyT1994 Sep 26, 2025
500e919
Define partitions_graph(g::AbstractGraph)
JoeyT1994 Sep 26, 2025
def431d
PartitionsGraphView
mtfishman Sep 26, 2025
2ea8cb6
Merge branch 'main' into main
mtfishman Sep 26, 2025
1bf06d5
Merge branch 'main' into mf/partitionsgraphview
mtfishman Sep 26, 2025
9b805b0
Create conflict
mtfishman Sep 26, 2025
cc6638c
Merge branch 'mf/partitionsgraphview' of github.com:mtfishman/NamedGr…
mtfishman Sep 26, 2025
3aeffc3
Mark as breaking
mtfishman Sep 26, 2025
c9a6c7a
Merge pull request #1 from ITensor/mf/partitionsgraphview
JoeyT1994 Sep 26, 2025
28dc06f
Bump subdir versions
mtfishman Sep 26, 2025
ee14afe
Bump subdir versions
mtfishman Sep 26, 2025
5ab5ff2
Bump subdir versions
mtfishman Sep 26, 2025
986acb6
Merge
JoeyT1994 Sep 26, 2025
d4fbe95
Merge remote-tracking branch 'origin/main'
JoeyT1994 Sep 26, 2025
75bd0f1
Merge remote-tracking branch 'origin/main'
JoeyT1994 Jul 6, 2026
43e4ba0
Fix edge subgraph
JoeyT1994 Jul 8, 2026
035046c
Update tests
JoeyT1994 Jul 8, 2026
1e9c330
Fix Project file
JoeyT1994 Jul 8, 2026
7b632f3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 8, 2026
70db0ed
Format
JoeyT1994 Jul 8, 2026
2bd39eb
Merge remote-tracking branch 'refs/remotes/origin/Fix_Edge_Subgraph' …
JoeyT1994 Jul 8, 2026
5c2b291
Make abstract
JoeyT1994 Jul 8, 2026
cbb071e
Use Set(edgeset)
JoeyT1994 Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "NamedGraphs"
uuid = "678767b0-92e7-4007-89e4-4527a8725b19"
version = "0.12.1"
version = "0.12.2"
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>, Joseph Tindall <jtindall@flatironinstitute.org> and contributors"]

[workspace]
Expand Down
7 changes: 6 additions & 1 deletion src/abstractnamedgraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,11 @@ end
function edge_subgraph_namedgraph(graph, edgelist)
vs = unique(vcat(src.(edgelist), dst.(edgelist)))
g = subgraph(graph, vs)
g = rem_edges!(g, setdiff(edges(g), edgelist))
edgeset = Set(edgelist)
for e in edges(g)
if !(e ∈ edgeset || reverse(e) ∈ edgeset)
rem_edge!(g, e)
end
end
return g
end
7 changes: 7 additions & 0 deletions src/namedgraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,10 @@ end
function GraphsExtensions.similar_graph(T::Type{<:GenericNamedGraph}, vertices)
return T(vertices)
end

function edge_subgraph_namedgraph(graph::NamedDiGraph, edgelist)
vs = unique(vcat(src.(edgelist), dst.(edgelist)))
g = subgraph(graph, vs)
g = rem_edges!(g, setdiff(edges(g), edgelist))
return g
end
33 changes: 29 additions & 4 deletions test/test_namedgraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ using Graphs: Edge, a_star, add_edge!, add_vertex!, adjacency_matrix,
using GraphsFlows: GraphsFlows
using NamedGraphs.GraphsExtensions: GraphsExtensions, boundary_edges, boundary_vertices,
convert_vertextype, degrees, dijkstra_mst, dijkstra_parents, dijkstra_tree,
eccentricities, has_vertices, incident_edges, indegrees, inner_boundary_vertices,
mincut_partitions, outdegrees, outer_boundary_vertices, permute_vertices,
rename_vertices, subgraph, symrcm_perm, symrcm_permute, vertextype, ⊔
using NamedGraphs.NamedGraphGenerators: named_binary_tree, named_grid, named_path_graph
eccentricities, edge_subgraph, has_vertices, incident_edges, indegrees,
inner_boundary_vertices, mincut_partitions, outdegrees, outer_boundary_vertices,
permute_vertices, rename_vertices, subgraph, symrcm_perm, symrcm_permute, vertextype, ⊔
using NamedGraphs.NamedGraphGenerators:
named_binary_tree, named_grid, named_hexagonal_lattice_graph, named_path_graph
using NamedGraphs: AbstractNamedEdge, NamedDiGraph, NamedEdge, NamedGraph, Vertices
using SymRCM: SymRCM
using Test: @test, @test_broken, @testset
Expand Down Expand Up @@ -118,6 +119,30 @@ end
# Test Graphs.jl `getindex` syntax.
@test g_sub == g[Vertices(["A", "B"])]

g_sub = edge_subgraph(g, NamedEdge.(["A" => "B"]))
@test has_vertex(g_sub, "A")
@test has_vertex(g_sub, "B")
@test !has_vertex(g_sub, "C")
@test !has_vertex(g_sub, "D")
@test has_edge(g_sub, "A" => "B")
# Test Graphs.jl `getindex` syntax.
@test g_sub == g[Vertices(["A", "B"])]

g = named_hexagonal_lattice_graph(3, 3)
es = NamedEdge.(
[
(1, 1) => (2, 1),
(2, 1) => (3, 1),
(3, 1) => (3, 2),
(2, 2) => (3, 2),
(1, 2) => (2, 2),
(1, 1) => (1, 2),
]
)
@test all([e in edges(g) for e in es])
eg = edge_subgraph(g, es)
@test length(edges(eg)) == length(es)

g = NamedGraph(["A", "B", "C", "D", "E"])
add_edge!(g, "A" => "B")
add_edge!(g, "B" => "C")
Expand Down
Loading