makeAdjMatrix {dga}R Documentation

Adjacency Matrix Converter

Description

Converts a cliques and separators into an adjacency matrix representation of a graph.

Usage

makeAdjMatrix(graph, p)

Arguments

graph

All the graphs.

p

The number of lists.

Details

This is only a helper function to use in the experimental plotting function PlotTopGraphs.

Value

an adjacency matrix

Author(s)

James Johndrow james.johndrow@gmail.com and Kristian Lum kl@hrdag.org

Examples



## The function is currently defined as
function (graph, p) 
{
    Adj <- matrix(0, nrow = p, ncol = p)
    diag(Adj) <- 1
    for (i in 1:length(graph$C)) {
        if (length(graph$C[[i]]) > 1) {
            combns <- combn(graph$C[[i]], 2)
            Adj[combns[1], combns[2]] <- 1
        }
    }
    for (i in 1:length(graph$S)) {
        if (length(graph$S[[i]]) > 1) {
            combns <- combn(graph$S[[i]], 2)
            Adj[combns[1], combns[2]] <- 1
        }
    }
    Adj <- Adj + t(Adj)
    Adj[Adj > 1] <- 1
    return(Adj)
  }

[Package dga version 1.2 Index]