Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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,7 +1,7 @@
name = "DataGraphs"
uuid = "b5a273c3-7e6c-41f6-98bd-8d7f1525a36a"
version = "0.2.10"
authors = ["Matthew Fishman <mfishman@flatironinstitute.org> and contributors"]
version = "0.2.9"

[deps]
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
Expand Down
22 changes: 11 additions & 11 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
using DataGraphs: DataGraphs
using Documenter: Documenter, DocMeta, deploydocs, makedocs

DocMeta.setdocmeta!(DataGraphs, :DocTestSetup, :(using DataGraphs); recursive=true)
DocMeta.setdocmeta!(DataGraphs, :DocTestSetup, :(using DataGraphs); recursive = true)

include("make_index.jl")

makedocs(;
modules=[DataGraphs],
authors="ITensor developers <support@itensor.org> and contributors",
sitename="DataGraphs.jl",
format=Documenter.HTML(;
canonical="https://itensor.github.io/DataGraphs.jl",
edit_link="main",
assets=["assets/favicon.ico", "assets/extras.css"],
),
pages=["Home" => "index.md", "Reference" => "reference.md"],
modules = [DataGraphs],
authors = "ITensor developers <support@itensor.org> and contributors",
sitename = "DataGraphs.jl",
format = Documenter.HTML(;
canonical = "https://itensor.github.io/DataGraphs.jl",
edit_link = "main",
assets = ["assets/favicon.ico", "assets/extras.css"],
),
pages = ["Home" => "index.md", "Reference" => "reference.md"],
)

deploydocs(; repo="github.com/ITensor/DataGraphs.jl", devbranch="main", push_preview=true)
deploydocs(; repo = "github.com/ITensor/DataGraphs.jl", devbranch = "main", push_preview = true)
16 changes: 8 additions & 8 deletions docs/make_index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ using Literate: Literate
using DataGraphs: DataGraphs

function ccq_logo(content)
include_ccq_logo = """
include_ccq_logo = """
```@raw html
<img class="display-light-only" src="assets/CCQ.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
<img class="display-dark-only" src="assets/CCQ-dark.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
```
"""
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
return content
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
return content
end

Literate.markdown(
joinpath(pkgdir(DataGraphs), "examples", "README.jl"),
joinpath(pkgdir(DataGraphs), "docs", "src");
flavor=Literate.DocumenterFlavor(),
name="index",
postprocess=ccq_logo,
joinpath(pkgdir(DataGraphs), "examples", "README.jl"),
joinpath(pkgdir(DataGraphs), "docs", "src");
flavor = Literate.DocumenterFlavor(),
name = "index",
postprocess = ccq_logo,
)
16 changes: 8 additions & 8 deletions docs/make_readme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ using Literate: Literate
using DataGraphs: DataGraphs

function ccq_logo(content)
include_ccq_logo = """
include_ccq_logo = """
<picture>
<source media="(prefers-color-scheme: dark)" width="20%" srcset="docs/src/assets/CCQ-dark.png">
<img alt="Flatiron Center for Computational Quantum Physics logo." width="20%" src="docs/src/assets/CCQ.png">
</picture>
"""
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
return content
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
return content
end

Literate.markdown(
joinpath(pkgdir(DataGraphs), "examples", "README.jl"),
joinpath(pkgdir(DataGraphs));
flavor=Literate.CommonMarkFlavor(),
name="README",
postprocess=ccq_logo,
joinpath(pkgdir(DataGraphs), "examples", "README.jl"),
joinpath(pkgdir(DataGraphs));
flavor = Literate.CommonMarkFlavor(),
name = "README",
postprocess = ccq_logo,
)
2 changes: 1 addition & 1 deletion examples/README.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# # DataGraphs.jl
#
#
# [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://itensor.github.io/DataGraphs.jl/stable/)
# [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://itensor.github.io/DataGraphs.jl/dev/)
# [![Build Status](https://github.com/ITensor/DataGraphs.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/DataGraphs.jl/actions/workflows/Tests.yml?query=branch%3Amain)
Expand Down
2 changes: 1 addition & 1 deletion examples/datagraph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using DataGraphs: DataGraph
using Graphs: Edge, grid, has_edge, has_vertex

g = grid((4,))
dg = DataGraph(g; vertex_data_eltype=String, edge_data_eltype=Symbol)
dg = DataGraph(g; vertex_data_eltype = String, edge_data_eltype = Symbol)
@show !isassigned(dg, Edge(1, 2))
@show !isassigned(dg, 1 => 2)
@show !isassigned(dg, Edge(1 => 2))
Expand Down
6 changes: 3 additions & 3 deletions examples/disjoint_union.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ using NamedGraphs.GraphsExtensions: ⊔
using NamedGraphs.NamedGraphGenerators: named_grid
using DataGraphs: DataGraph

g = DataGraph(named_grid((2, 2)); vertex_data_eltype=String, edge_data_eltype=String)
g = DataGraph(named_grid((2, 2)); vertex_data_eltype = String, edge_data_eltype = String)

for v in vertices(g)
g[v] = "V$v"
g[v] = "V$v"
end
for e in edges(g)
g[e] = "E$e"
g[e] = "E$e"
end

gg = g ⊔ g
Expand Down
2 changes: 1 addition & 1 deletion examples/multidimdatagraph_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Graphs: grid, has_edge, has_vertex
using NamedGraphs: NamedGraph, NamedEdge

g = NamedGraph(grid((4,)), ["A", "B", "C", "D"])
dg = DataGraph(g; vertex_data_eltype=String, edge_data_eltype=Symbol)
dg = DataGraph(g; vertex_data_eltype = String, edge_data_eltype = Symbol)

@show has_vertex(dg, "A")
@show has_vertex(dg, "D")
Expand Down
2 changes: 1 addition & 1 deletion examples/multidimdatagraph_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using NamedGraphs: NamedEdge
using NamedGraphs.NamedGraphGenerators: named_grid

g = named_grid((2, 2))
dg = DataGraph(g; vertex_data_eltype=String, edge_data_eltype=String)
dg = DataGraph(g; vertex_data_eltype = String, edge_data_eltype = String)

dg[1, 1] = "X11"

Expand Down
2 changes: 1 addition & 1 deletion examples/slicing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using NamedGraphs.NamedGraphGenerators: named_grid
using Graphs: ne, nv

g = named_grid((2, 2))
dg = DataGraph(g; vertex_data_eltype=String, edge_data_eltype=String)
dg = DataGraph(g; vertex_data_eltype = String, edge_data_eltype = String)

dg[1, 1] = "V11"
dg[1, 2] = "V12"
Expand Down
2 changes: 1 addition & 1 deletion ext/DataGraphsGraphsFlowsExt/DataGraphsGraphsFlowsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ using DataGraphs: AbstractDataGraph, underlying_graph
using GraphsFlows: GraphsFlows

function GraphsFlows.mincut(graph::AbstractDataGraph, args...; kwargs...)
return GraphsFlows.mincut(underlying_graph(graph), args...; kwargs...)
return GraphsFlows.mincut(underlying_graph(graph), args...; kwargs...)
end
end
32 changes: 16 additions & 16 deletions ext/DataGraphsNamedGraphsExt/DataGraphsNamedGraphsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ using NamedGraphs: NamedGraphs, AbstractNamedGraph
DataGraphs.is_underlying_graph(::Type{<:AbstractNamedGraph}) = true

for f in [:(NamedGraphs.position_graph), :(NamedGraphs.vertex_positions)]
@eval begin
function $f(graph::AbstractDataGraph)
return $f(underlying_graph(graph))
@eval begin
function $f(graph::AbstractDataGraph)
return $f(underlying_graph(graph))
end
end
end
end

using Graphs: edgetype, vertices
Expand All @@ -18,23 +18,23 @@ using NamedGraphs.OrdinalIndexing: OrdinalSuffixedInteger
# (analagous to Julia's `to_indices`) instead of through
# overloading `Base.getindex`.
function Base.getindex(graph::AbstractDataGraph, vertex::OrdinalSuffixedInteger)
return graph[vertices(graph)[vertex]]
return graph[vertices(graph)[vertex]]
end
function Base.getindex(
graph::AbstractDataGraph, edge::Pair{<:OrdinalSuffixedInteger,<:OrdinalSuffixedInteger}
)
return graph[edgetype(graph)(vertices(graph)[edge[1]], vertices(graph)[edge[2]])]
graph::AbstractDataGraph, edge::Pair{<:OrdinalSuffixedInteger, <:OrdinalSuffixedInteger}
)
return graph[edgetype(graph)(vertices(graph)[edge[1]], vertices(graph)[edge[2]])]
end
function Base.setindex!(graph::AbstractDataGraph, value, vertex::OrdinalSuffixedInteger)
graph[vertices(graph)[vertex]] = value
return graph
graph[vertices(graph)[vertex]] = value
return graph
end
function Base.setindex!(
graph::AbstractDataGraph,
value,
edge::Pair{<:OrdinalSuffixedInteger,<:OrdinalSuffixedInteger},
)
graph[edgetype(graph)(vertices(graph)[edge[1]], vertices(graph)[edge[2]])] = value
return graph
graph::AbstractDataGraph,
value,
edge::Pair{<:OrdinalSuffixedInteger, <:OrdinalSuffixedInteger},
)
graph[edgetype(graph)(vertices(graph)[edge[1]], vertices(graph)[edge[2]])] = value
return graph
end
end
Loading