Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
#' @title Partial ranking as directed graph
|
|
2 |
#' @description Turns a partial ranking into a directed graph. An edge (u,v) is
|
|
3 |
#' present if `P[u,v]=1`, meaning that u is dominated by v.
|
|
4 |
#'
|
|
5 |
#' @param P A partial ranking as matrix object calculated with [neighborhood_inclusion]
|
|
6 |
#' or [positional_dominance].
|
|
7 |
#' @return Directed graph as an igraph object.
|
|
8 |
#' @author David Schoch
|
|
9 |
#' @examples
|
|
10 |
#' library(igraph)
|
|
11 |
#' g <- threshold_graph(20,0.1)
|
|
12 |
#' P <- neighborhood_inclusion(g)
|
|
13 |
#' d <- dominance_graph(P)
|
|
14 |
#' \dontrun{plot(d)}
|
|
15 |
#'
|
|
16 |
#' # to reduce overplotting use transitive reduction
|
|
17 |
#' P <- transitive_reduction(P)
|
|
18 |
#' d <- dominance_graph(P)
|
|
19 |
#' \dontrun{plot(d)}
|
|
20 |
#' @export
|
|
21 |
dominance_graph <- function(P) { |
|
22 | 1 |
d <- igraph::graph_from_adjacency_matrix(P, "directed") |
23 | 1 |
return(d) |
24 |
}
|
Read our documentation on viewing source code .