-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sebastien-plutniak
committed
Jul 13, 2022
1 parent
6d8a155
commit ab3e853
Showing
36 changed files
with
573 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
|
||
frag.get.layers <- function(graph, layer.attr, sel.layers){ | ||
if(! is.igraph(graph)) stop("Not a graph object") | ||
if( ! is.character(layer.attr)) stop("The parameter 'layer.attr' requires a character value.") | ||
if(is.null(vertex_attr(graph, layer.attr))) stop("The parameter 'layer.attr' is required.") | ||
if( ! layer.attr %in% names(vertex_attr(graph)) ){ | ||
stop(paste("No '", layer.attr, "' vertices attribute", sep="")) | ||
} | ||
# tests: | ||
.check.frag.graph(graph) | ||
.check.layer.argument(graph, layer.attr) | ||
|
||
layers <- vertex_attr(graph, layer.attr) | ||
# function: | ||
layers <- igraph::vertex_attr(graph, layer.attr) | ||
if(sum(sel.layers %in% layers) != length(sel.layers)) stop("Some of the 'selected layers' are not in the 'layers' vector.") | ||
|
||
g.list <- lapply(sel.layers, | ||
function(x) induced_subgraph(graph, V(graph)[layers == x] )) | ||
function(x) igraph::induced_subgraph(graph, V(graph)[layers == x] )) | ||
names(g.list) <- sel.layers | ||
g.list | ||
} |
Oops, something went wrong.