Learn R Programming

catnet (version 1.08.2)

cnCatnetFromGraph: catNetwork from Graph

Description

Creates a catNetwork object with the edge structure inherited from a graph.

Usage

cnCatnetFromGraph(graph, numCategories = 2, cats=NULL, probs=NULL)

Arguments

graph
a graph object
numCategories
an integer, the number of categories per node
cats
a list of categories
probs
a list of probabilities

Value

  • A catNetwork object.

Details

The user may specify the number of categories (default value is 2), the list of node categories and the list of conditional probabilities. If no categories or probabilities are given, random ones are generated.

See Also

cnNew, cnCatnetFromSif

Examples

Run this code
library(graph)
  myNodes<-c("a","s","p","q","r","t","u")
  myEdges<-list(
		a=list(edges=NULL), 
		s=list(edges=c("p","q")), 
		p=list(edges=c("q")), 
		q=list(edges=("r")), 
		r=list(edges=c("u")), 
		t=list(edges=c("q")), 
		u=list(edges=NULL))
  gr<-new("graphNEL", nodes=myNodes, edgeL=myEdges, edgemode="directed")
  cnet <- cnCatnetFromGraph(graph=gr)

Run the code above in your browser using DataLab