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 2
    d <- igraph::graph_from_adjacency_matrix(P, "directed")
23 2
    return(d)
24
}

Read our documentation on viewing source code .

Loading