Daniel@0:
Visualizing graph structures in matlab
Daniel@0:
Daniel@0: We discuss some methods for visualizing graphs/ networks, including automatic
Daniel@0: layout of the nodes.
Daniel@0: We assume the graph is represented as an adjacency matrix.
Daniel@0: If using BNT, you can access the DAG using
Daniel@0:
Daniel@0: G = bnet.dag;
Daniel@0:
Daniel@0:
Daniel@0: Matlab's biograph function
Daniel@0:
Daniel@0: The Mathworks computational biology toolbox
Daniel@0: has many useful graph related functions, including visualization.
Daniel@0:
Daniel@0: Click
Daniel@0:
Daniel@0: here
Daniel@0: for a demo.
Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0: Cemgil's draw_graph
Daniel@0:
Daniel@0: You can visualize an arbitrary graph (such as one learned using the
Daniel@0: structure learning routines) with Matlab code written by
Daniel@0:
Daniel@0: Ali Taylan Cemgil
Daniel@0: from the University of Cambridge.
Daniel@0: A modified version of this code
Daniel@0: is here
Daniel@0: (this is already bundled with BNT).
Daniel@0: Just type
Daniel@0:
Daniel@0: draw_graph(G);
Daniel@0:
Daniel@0: For example, this is the output produced on a
Daniel@0: random QMR-like model:
Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0:
Daniel@0:
Pajek
Daniel@0:
Daniel@0: Pajek
Daniel@0: is an excellent, free Windows program for graph layout.
Daniel@0: Use adj2pajek2.m to convert a graph to the
Daniel@0: Pajek file format.
Daniel@0:
Daniel@0: Then Choose File->Network->Read from the menu.
Daniel@0:
Daniel@0: AT&T Graphviz
Daniel@0:
Daniel@0: graphhviz
Daniel@0: is an
Daniel@0: open-source graph visualization package from AT&T.
Daniel@0: Use
Daniel@0: graph_to_dot
Daniel@0: to convert an adjacency matrix to
Daniel@0: the AT&T file format (the "dot" format).
Daniel@0: You then use dot to convert it to postscript:
Daniel@0:
Daniel@0: graph_to_dot(G, 'filename', 'foo.dot');
Daniel@0: dot -Tps foo.dot -o foo.ps
Daniel@0: ghostview foo.ps &
Daniel@0: