user_guide:tutorials:apps_graph

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:apps_graph [2009/11/03 13:00] – created sherrmannuser_guide:apps_graph [2019/01/25 09:27] – ↷ Page moved from tutorial:apps_graph to user_guide:apps_graph oroehrig
Line 150: Line 150:
 </code> </code>
  
 +===== Directed Graphs =====
 +
 +By specifying the template parameter ''Directed'' a graph is born as a directed graph.  Properties which make sense for directed graphs work as expected.  A directed graph may have two arcs between any two nodes with opposite orientations.
 +
 +<code>
 +graph > $g=new objects::Graph<Directed>(ADJACENCY=>[[1],[2],[3],[2,4],[0]]);
 +graph > print $g->DIAMETER;
 +4
 +</code>
 +
 +Here is an example of an undirected graph property which does not make sense for directed graphs.
 +
 +<code>
 +graph > #print $g->MAX_CLIQUES;
 +
 +polymake:  ERROR: Object Graph<Directed> does not have a property or method MAX_CLIQUES
 +</code>
 +
 +Graphs with multiple edges/arcs are currently not supported.
 + 
 +
 +===== Visualizing Graphs =====
 +
 +Like other "big" ''polymake'' objects the ''Graph'' class has a member (function) ''VISUAL'' which returns an abstract visualization object.  Depending on the configuration it typically uses ''JReality'' or ''JavaView'' Particularly interesting for graph drawing is the visualization via ''Graphviz''.
 +
 +<code>
 +graph > graphviz($g->VISUAL);
 +</code>
 +
 +Note that the latter starts a postscript viewer with the ''Graphviz'' output.  Make sure that the custom variable ''$Postscript::viewer'' is set to something reasonable (like, e.g., ''/usr/bin/evince'').
  • user_guide/tutorials/apps_graph.txt
  • Last modified: 2019/02/04 22:55
  • by 127.0.0.1