Skip to content

Commit ed46a04

Browse files
committed
Support AttributeGraphs v0.3
1 parent 73f28da commit ed46a04

File tree

4 files changed

+33
-127
lines changed

4 files changed

+33
-127
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NestedGraphs"
22
uuid = "03c36417-ddab-428a-818d-5359aee292ef"
33
authors = ["fchrstou <[email protected]> and contributors"]
4-
version = "0.2"
4+
version = "0.2.1"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
@@ -22,7 +22,7 @@ AbstractTrees = "0.4"
2222
DocStringExtensions = "0.9"
2323
Graphs = "1"
2424
MetaGraphs = "0.7"
25-
AttributeGraphs = "0.2"
25+
AttributeGraphs = "0.3"
2626
SimpleTraits = "0.9"
2727

2828
julia = "1.9"

ext/NestedGraphsAttributeGraphsExt.jl

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ module NestedGraphsAttributeGraphsExt
33
using NestedGraphs, Graphs, DocStringExtensions
44
using AttributeGraphs
55

6-
import AttributeGraphs: AbstractAttibuteGraph, addgraphattr!, remgraphattr!, addvertexattr!, remvertexattr!, addedgeattr!, remedgeattr!, graph_attr, vertex_attr, edge_attr, addvertex!, remvertex!, addedge!, remedge!, hasedgeattr, hasgraphattr, hasvertexattr, getgraphattr, getvertexattr, getedgeattr
6+
import AttributeGraphs: AbstractAttributeGraph, addgraphattr!, remgraphattr!, addvertexattr!, remvertexattr!, addedgeattr!, remedgeattr!, graph_attr, vertex_attr, edge_attr, addvertex!, remvertex!, addedge!, remedge!, hasedgeattr, hasgraphattr, hasvertexattr, getgraphattr, getvertexattr, getedgeattr
77

8-
getgraphattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttibuteGraph} = getgraphattr(NestedGraphs.getgraph(ag), k)
9-
getvertexattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttibuteGraph} = getvertexattr(NestedGraphs.getgraph(ag), k)
10-
getedgeattr(ag::NestedGraph{T,G}, args...) where {T<:Integer,G<:AbstractAttibuteGraph} = getedgeattr(NestedGraphs.getgraph(ag), args...)
8+
getgraphattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttributeGraph} = getgraphattr(NestedGraphs.getgraph(ag), k)
9+
getvertexattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttributeGraph} = getvertexattr(NestedGraphs.getgraph(ag), k)
10+
getedgeattr(ag::NestedGraph{T,G}, args...) where {T<:Integer,G<:AbstractAttributeGraph} = getedgeattr(NestedGraphs.getgraph(ag), args...)
1111

12-
hasgraphattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttibuteGraph} = hasgraphattr(NestedGraphs.getgraph(ag), k)
13-
hasvertexattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttibuteGraph} = hasvertexattr(NestedGraphs.getgraph(ag), k)
14-
hasedgeattr(ag::NestedGraph{T,G}, args...) where {T<:Integer,G<:AbstractAttibuteGraph} = hasedgeattr(NestedGraphs.getgraph(ag), args...)
12+
hasgraphattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttributeGraph} = hasgraphattr(NestedGraphs.getgraph(ag), k)
13+
hasvertexattr(ag::NestedGraph{T,G}, k) where {T<:Integer,G<:AbstractAttributeGraph} = hasvertexattr(NestedGraphs.getgraph(ag), k)
14+
hasedgeattr(ag::NestedGraph{T,G}, args...) where {T<:Integer,G<:AbstractAttributeGraph} = hasedgeattr(NestedGraphs.getgraph(ag), args...)
1515

1616

17-
function addvertex!(ng::NestedGraph{T,G}; subgraphs=1) where {T<:Integer, G<:AbstractAttibuteGraph}
17+
function addvertex!(ng::NestedGraph{T,G}; subgraphs=1) where {T<:Integer, G<:AbstractAttributeGraph}
1818
subgraph = first(subgraphs)
1919
length(ng.grv) == 0 && (add_vertex!(ng, G()))
2020
targetnode = nv(ng.grv[subgraph])+1
@@ -24,7 +24,7 @@ function addvertex!(ng::NestedGraph{T,G}; subgraphs=1) where {T<:Integer, G<:Abs
2424
NestedGraphs._propagate_to_nested(ng, addvertex!, subgraphs)
2525
end
2626

27-
function remvertex!(ng::NestedGraph{T,G}, v::T) where {T<:Integer, G<:AbstractAttibuteGraph}
27+
function remvertex!(ng::NestedGraph{T,G}, v::T) where {T<:Integer, G<:AbstractAttributeGraph}
2828
Graphs.has_vertex(ng, v) || return false
2929
remvertex!(ng.flatgr, v)
3030
nver = ng.vmap[v]
@@ -33,9 +33,9 @@ function remvertex!(ng::NestedGraph{T,G}, v::T) where {T<:Integer, G<:AbstractAt
3333
NestedGraphs.update_vmapneds_after_delete!(ng, nver)
3434
end
3535

36-
addedge!(mg::NestedGraph{T,G}, args...) where {T<:Integer, G<:AbstractAttibuteGraph} = add_edge!(mg, args...)
36+
addedge!(mg::NestedGraph{T,G}, args...) where {T<:Integer, G<:AbstractAttributeGraph} = add_edge!(mg, args...)
3737

38-
function remedge!(ng::NestedGraph{T,G}, src::T, dst::T) where {T<:Integer, G<:AbstractAttibuteGraph}
38+
function remedge!(ng::NestedGraph{T,G}, src::T, dst::T) where {T<:Integer, G<:AbstractAttributeGraph}
3939
Graphs.has_edge(ng, src, dst) || return false
4040
remedge!(ng.flatgr, src, dst)
4141
srctup = ng.vmap[src]
@@ -47,37 +47,37 @@ function remedge!(ng::NestedGraph{T,G}, src::T, dst::T) where {T<:Integer, G<:Ab
4747
end
4848
end
4949

50-
addgraphattr!(ng::NestedGraph{T,G}, k, v) where {T<:Integer, G<:AbstractAttibuteGraph} = addgraphattr!(NestedGraphs.getgraph(ng), k, v)
51-
remgraphattr!(ng::NestedGraph{T,G}, k) where {T<:Integer, G<:AbstractAttibuteGraph} = remgraphattr!(NestedGraphs.getgraph(ng), k)
50+
addgraphattr!(ng::NestedGraph{T,G}, k, v) where {T<:Integer, G<:AbstractAttributeGraph} = addgraphattr!(NestedGraphs.getgraph(ng), k, v)
51+
remgraphattr!(ng::NestedGraph{T,G}, k) where {T<:Integer, G<:AbstractAttributeGraph} = remgraphattr!(NestedGraphs.getgraph(ng), k)
5252

53-
function addvertexattr!(ng::NestedGraph{T,G}, k, v) where {T<:Integer, G<:AbstractAttibuteGraph}
53+
function addvertexattr!(ng::NestedGraph{T,G}, k, v) where {T<:Integer, G<:AbstractAttributeGraph}
5454
addvertexattr!(NestedGraphs.getgraph(ng), k, v)
5555
addvertexattr!(ng.grv[ng.vmap[k][1]], ng.vmap[k][2], v)
5656
end
57-
function remvertexattr!(ng::NestedGraph{T,G}, k) where {T<:Integer, G<:AbstractAttibuteGraph}
57+
function remvertexattr!(ng::NestedGraph{T,G}, k) where {T<:Integer, G<:AbstractAttributeGraph}
5858
remvertexattr!(NestedGraphs.getgraph(ng), k)
5959
remvertexattr!(ng.grv[ng.vmap[k][1]], ng.vmap[k][2])
6060
end
6161

62-
remedgeattr!(ng::NestedGraph{T,G}, e::AbstractEdge, args...) where {T<:Integer, G<:AbstractAttibuteGraph} = remedgeattr!(ng, src(e), dst(e), args...)
63-
function remedgeattr!(ng::NestedGraph{T,G}, s::T, d::T, args...) where {T<:Integer, G<:AbstractAttibuteGraph}
62+
remedgeattr!(ng::NestedGraph{T,G}, e::AbstractEdge, args...) where {T<:Integer, G<:AbstractAttributeGraph} = remedgeattr!(ng, src(e), dst(e), args...)
63+
function remedgeattr!(ng::NestedGraph{T,G}, s::T, d::T, args...) where {T<:Integer, G<:AbstractAttributeGraph}
6464
remedgeattr!(NestedGraphs.getgraph(ng), s, d, args...)
6565
if NestedGraphs.issamesubgraph(ng, s, d)
6666
remedgeattr!(ng.grv[ng.vmap[s][1]], ng.vmap[s][2], ng.vmap[d][2], args...)
6767
end
6868
end
6969

70-
addedgeattr!(ng::NestedGraph{T,G}, e::AbstractEdge, args...) where {T<:Integer, G<:AbstractAttibuteGraph} = addedgeattr!(ng, src(e), dst(e), args...)
71-
function addedgeattr!(ng::NestedGraph{T,G}, s::T, d::T, args...) where {T<:Integer, G<:AbstractAttibuteGraph}
70+
addedgeattr!(ng::NestedGraph{T,G}, e::AbstractEdge, args...) where {T<:Integer, G<:AbstractAttributeGraph} = addedgeattr!(ng, src(e), dst(e), args...)
71+
function addedgeattr!(ng::NestedGraph{T,G}, s::T, d::T, args...) where {T<:Integer, G<:AbstractAttributeGraph}
7272
addedgeattr!(NestedGraphs.getgraph(ng), s, d, args...)
7373
if NestedGraphs.issamesubgraph(ng, s, d)
7474
addedgeattr!(ng.grv[ng.vmap[s][1]], ng.vmap[s][2], ng.vmap[d][2], args...)
7575
end
7676
end
7777

78-
vertex_attr(mg::NestedGraph{T,G}) where {T<:Integer, G<:AbstractAttibuteGraph} = vertex_attr(NestedGraphs.getgraph(mg))
79-
edge_attr(mg::NestedGraph{T,G}) where {T<:Integer, G<:AbstractAttibuteGraph} = edge_attr(NestedGraphs.getgraph(mg))
80-
graph_attr(mg::NestedGraph{T,G}) where {T<:Integer, G<:AbstractAttibuteGraph} = graph_attr(NestedGraphs.getgraph(mg))
78+
vertex_attr(mg::NestedGraph{T,G}) where {T<:Integer, G<:AbstractAttributeGraph} = vertex_attr(NestedGraphs.getgraph(mg))
79+
edge_attr(mg::NestedGraph{T,G}) where {T<:Integer, G<:AbstractAttributeGraph} = edge_attr(NestedGraphs.getgraph(mg))
80+
graph_attr(mg::NestedGraph{T,G}) where {T<:Integer, G<:AbstractAttributeGraph} = graph_attr(NestedGraphs.getgraph(mg))
8181

8282
# I need to implement shallow copy
8383
function NestedGraphs.shallowcopy_vertices!(g1::AttributeGraph{T,G,V}, g2::AttributeGraph{T,G,V}) where {T<:Integer,G<:AbstractGraph{T},V<:AbstractVector}
@@ -102,7 +102,7 @@ end
102102

103103

104104
# multilayer.jl
105-
function getsquashedgraph(ng::NestedGraph{T,R,N}, sqvertices::Vector{Vector{Q}}) where {T,R<:AbstractAttibuteGraph,N,Q<:Integer}
105+
function getsquashedgraph(ng::NestedGraph{T,R,N}, sqvertices::Vector{Vector{Q}}) where {T,R<:AbstractAttributeGraph,N,Q<:Integer}
106106
# squashedgraph = ng.flatgr |> deepcopy |> adjacency_matrix |> SimpleGraph
107107
squashedgraph = getsimplegraphcopy(ng)
108108
_rec_merge_vertices!(SimpleGraph(squashedgraph), sqvertices)

src/attributegraphs.jl

Lines changed: 0 additions & 94 deletions
This file was deleted.

test/Manifest.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.9.0"
3+
julia_version = "1.9.1"
44
manifest_format = "2.0"
55
project_hash = "4c10ced6dbf6a1004a10f82866da531e325c4d73"
66

@@ -24,18 +24,18 @@ uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
2424

2525
[[deps.AttributeGraphs]]
2626
deps = ["DocStringExtensions", "Graphs"]
27-
git-tree-sha1 = "35f8c0b552ad5ec872078db8c5cf61119b01671a"
27+
git-tree-sha1 = "a92f0a56ce4faebcc8668d764a346be90bc5161f"
2828
uuid = "d091dd56-f8c5-469d-b7f7-ff847498145f"
29-
version = "0.2.0"
29+
version = "0.3.0"
3030

3131
[[deps.Base64]]
3232
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
3333

3434
[[deps.Compat]]
3535
deps = ["UUIDs"]
36-
git-tree-sha1 = "7a60c856b9fa189eb34f5f8a6f6b5529b7942957"
36+
git-tree-sha1 = "4e88377ae7ebeaf29a047aa1ee40826e0b708a5d"
3737
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
38-
version = "4.6.1"
38+
version = "4.7.0"
3939
weakdeps = ["Dates", "LinearAlgebra"]
4040

4141
[deps.Compat.extensions]
@@ -48,9 +48,9 @@ version = "1.0.2+0"
4848

4949
[[deps.DataStructures]]
5050
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
51-
git-tree-sha1 = "d1fff3a548102f48987a52a2e0d114fa97d730f0"
51+
git-tree-sha1 = "cf25ccb972fec4e4817764d01c82386ae94f77b4"
5252
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
53-
version = "0.18.13"
53+
version = "0.18.14"
5454

5555
[[deps.Dates]]
5656
deps = ["Printf"]
@@ -302,7 +302,7 @@ version = "1.2.13+0"
302302
[[deps.libblastrampoline_jll]]
303303
deps = ["Artifacts", "Libdl"]
304304
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
305-
version = "5.7.0+0"
305+
version = "5.8.0+0"
306306

307307
[[deps.nghttp2_jll]]
308308
deps = ["Artifacts", "Libdl"]

0 commit comments

Comments
 (0)