Learn R Programming

BiDAG (version 2.1.4)

m2graph: Deriving a graph from an adjacancy matrix

Description

This function derives a graph object corresponding to an adjacency matrix

Usage

m2graph(adj, nodes = NULL)

Value

object of class graphNEL (package `graph'); if element adj[i,j] equals 1, then there is a directed edge from node i to node j in the graph, and no edge otherwise

Arguments

adj

square adjacency matrix with elements in {0,1}, representing a graph

nodes

(optional) labels of the nodes, c(1:n) are used by default

Examples

Run this code
m2graph(Asiamat)

Run the code above in your browser using DataLab