lib.notebook.showMRF
- pyagrum.lib.notebook.showMRF(mrf, view=None, size=None, nodeColor=None, factorColor=None, edgeWidth=None, edgeColor=None, cmapNode=None, cmapEdge=None)
show a Markov random field
- Parameters:
mrf (
pyagrum.MarkovRandomField) – the Markov random fieldview (
str) – ‘graph’ | ‘factorgraph’ | None (default)size (
str) – size (for graphviz) of the rendered graphnodeColor (
dict[int,float]) – a nodeMap of values (between 0 and 1) to be shown as color of nodes (with special colors for 0 and 1)factorColor (
dict[int,float]) – a function returning a value (between 0 and 1) to be shown as a color of factor. (used when view=’factorgraph’)edgeWidth (
dict[tuple[int,int],float]) – a edgeMap of values to be shown as width of edges (used when view=’graph’)edgeColor (
dict[int,float]) – a edgeMap of values (between 0 and 1) to be shown as color of edges (used when view=’graph’)cmapNode (
dict[tuple[int,int],float]) – color map to show the colors (if cmapEdge is None, this color map is used also for edges)cmapEdge (
"matplotlib.ColorMap") – color map to show the edge color if distinction is needed
- Return type:
None- Returns:
the graph
Example
import pyagrum as gum
import pyagrum.lib.notebook as gnb
gnb.showMRF(gum.fastMRF("A--B--C;C--D"), view="graph")