Skip to content

Commit de5e05a

Browse files
committed
hasOrphans
1 parent 8fa2d56 commit de5e05a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/services/GraphsDFG.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export getAdjacencyMatrixDataFrame
2727
export getNeighbors
2828
export getSubgraphAroundNode
2929
export getSubgraph
30-
export isFullyConnected
30+
export isFullyConnected, hasOrphans
3131

3232
mutable struct GraphsDFG <: AbstractDFG
3333
g::FGType
@@ -252,6 +252,9 @@ function isFullyConnected(dfg::GraphsDFG)::Bool
252252
return length(connected_components(dfg.g)) == 1
253253
end
254254

255+
#Alias
256+
hasOrphans(dfg::GraphsDFG)::Bool = !isFullyConnected(dfg)
257+
255258
"""
256259
$(SIGNATURES)
257260
Retrieve a list of labels of the immediate neighbors around a given variable or factor.

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ end
5252
@testset "Connectivity Test" begin
5353
global dfg,v1,v2,f1
5454
@test isFullyConnected(dfg) == true
55+
@test hasOrphans(dfg) == false
5556
addVariable!(dfg, DFGVariable(:orphan))
5657
@test isFullyConnected(dfg) == false
58+
@test hasOrphans(dfg) == true
5759
end
5860

5961
# Adjacency matrices

0 commit comments

Comments
 (0)