Skip to content

Commit

Permalink
fix typo infinte -> infinite
Browse files Browse the repository at this point in the history
  • Loading branch information
stecrotti committed Apr 12, 2024
1 parent 51dcedd commit 6b10975
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FactorGraphs"
uuid = "edf0a622-c16b-410a-a162-e53dc16a76ae"
authors = ["stecrotti <[email protected]>"]
version = "1.0.0-DEV"
version = "0.1.0"

[deps]
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Expand Down
2 changes: 1 addition & 1 deletion src/FactorGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export FactorGraph, nvariables, nfactors, variables, factors, factor, variable,
edge_indices, inedges, outedges,
adjacency_matrix, is_cyclic
export rand_factor_graph, rand_regular_factor_graph, rand_tree_factor_graph
export InfinteRegularFactorGraph
export InfiniteRegularFactorGraph

end
32 changes: 16 additions & 16 deletions src/infinite_regular_factorgraph.jl
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
"""
InfinteRegularFactorGraph <: AbstractFactorGraph
InfiniteRegularFactorGraph <: AbstractFactorGraph
A type to represent an infinite regular factor graph with fixed factor and variable degree
"""
struct InfinteRegularFactorGraph{T<:Integer} <: AbstractFactorGraph{T}
struct InfiniteRegularFactorGraph{T<:Integer} <: AbstractFactorGraph{T}
kᵢ :: T # variable degree
kₐ :: T # factor degree

function InfinteRegularFactorGraph(kₐ::T, kᵢ::T) where {T<:Integer}
function InfiniteRegularFactorGraph(kₐ::T, kᵢ::T) where {T<:Integer}
kᵢ > 0 || throw(ArgumentError("Factor degree must be positive, got $kᵢ"))
kₐ > 0 || throw(ArgumentError("Factor degree must be positive, got $kₐ"))
return new{T}(kᵢ, kₐ)
end
end

function Base.show(io::IO, g::InfinteRegularFactorGraph{T}) where T
println(io, "InfinteRegularFactorGraph{$T} of variable degree $(g.kᵢ) and factor degree $(g.kₐ)")
function Base.show(io::IO, g::InfiniteRegularFactorGraph{T}) where T
println(io, "InfiniteRegularFactorGraph{$T} of variable degree $(g.kᵢ) and factor degree $(g.kₐ)")
end

nvariables(::InfinteRegularFactorGraph) = 1
nfactors(::InfinteRegularFactorGraph) = 1
Graphs.ne(::InfinteRegularFactorGraph) = 1
Graphs.edges(::InfinteRegularFactorGraph) = (IndexedEdge(1,1,1) for _ in 1:1)
variables(::InfinteRegularFactorGraph) = 1:1
factors(::InfinteRegularFactorGraph) = 1:1
nvariables(::InfiniteRegularFactorGraph) = 1
nfactors(::InfiniteRegularFactorGraph) = 1
Graphs.ne(::InfiniteRegularFactorGraph) = 1
Graphs.edges(::InfiniteRegularFactorGraph) = (IndexedEdge(1,1,1) for _ in 1:1)
variables(::InfiniteRegularFactorGraph) = 1:1
factors(::InfiniteRegularFactorGraph) = 1:1

IndexedGraphs.degree(g::InfinteRegularFactorGraph, v::FactorGraphVertex) = length(neighbors(g, v))
IndexedGraphs.degree(g::InfiniteRegularFactorGraph, v::FactorGraphVertex) = length(neighbors(g, v))

function IndexedGraphs.neighbors(g::InfinteRegularFactorGraph, ::FactorGraphVertex{Factor})
function IndexedGraphs.neighbors(g::InfiniteRegularFactorGraph, ::FactorGraphVertex{Factor})
return Fill(1, g.kₐ)
end
function IndexedGraphs.neighbors(g::InfinteRegularFactorGraph, ::FactorGraphVertex{Variable})
function IndexedGraphs.neighbors(g::InfiniteRegularFactorGraph, ::FactorGraphVertex{Variable})
return Fill(1, g.kᵢ)
end
edge_indices(g::InfinteRegularFactorGraph, ::FactorGraphVertex{Factor}) = Fill(1, g.kₐ)
edge_indices(g::InfinteRegularFactorGraph, ::FactorGraphVertex{Variable}) = Fill(1, g.kᵢ)
edge_indices(g::InfiniteRegularFactorGraph, ::FactorGraphVertex{Factor}) = Fill(1, g.kₐ)
edge_indices(g::InfiniteRegularFactorGraph, ::FactorGraphVertex{Variable}) = Fill(1, g.kᵢ)

0 comments on commit 6b10975

Please sign in to comment.